run Method

Summary

Initializes and builds the Viewer.

Syntax
TypeScript
JavaScript
Viewer.prototype.run = function( 
   runSettings, 
   settings 
) 
run( 
   runSettings: RunSettings, 
   settings: any 
): void; 

Parameters

runSettings

The RunSettings to use.

settings

Application settings for LEADVIEW.

Remarks

The run method initializes and builds the Viewer as follows:

  1. LEADVIEW checks the website root for a LEADVIEW folder. If this folder does not exist, then LEADVIEW creates it with default settings.
  2. LEADVIEW checks the current folder for a LEADVIEW.json file. If this file does not exist, then LEADVIEW creates it with default settings.
  3. LEADVIEW checks the current JSON file for a startupSettings key. It should contain the URI to the startup settings file to use.
  4. LEADVIEW attempts to fetch the startup settings file. If the key does not exist in the LEADVIEW.json file, or if the resource can not be retrieved, LEADVIEW creates it with default settings.

After LEADVIEW retrieves the base settings, the following checks are performed:

  1. LEADVIEW checks if the user settings are saved to Local Storage. If so, these settings are pulled and merged with the application's base settings.

    To prevent a user's Local Storage settings from over-riding the base setting, simply change the modifiable property value to false in the settings' json file. This will also prevent the user from being able to manipulate or see the settings in the Settings Dialog.

  2. Any settings provided to the run method are then merged.

So in summary, settings are passed in the following manner: run method > local storage settings > base application settings.

After the settings have been resolved, LEADVIEW then builds and injects itself into the DOM, based off of the creation ID provided in the settings.

Example
ViewerRun.ts
Run.html
export class ViewerRunExample { 
    public constructor() { 
        if(lt.RasterSupport.kernelExpired) 
            lt.RasterSupport.setLicenseUri("https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt", "EVAL", null); 
    } 
 
    public run = (divID: string): void => { 
        const lv = new lt.LEADVIEW.Viewer(); 
 
        // Builds a new instance of LEADVIEW. 
        // For the full list of options that can be passed to the run method, 
        // refer to the settings JSON files that are included in the LEADVIEW demo application. 
        // Settings files can also be generated from the LEADVIEW application itself. 
        lv.run(null, { 
            'rootDivId': divID 
        }); 
    } 
} 
<!doctype html> 
<html lang="en"> 
    <title>LV Examples | Run</title> 
    <head> 
        <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> 
 
        <script src="../LT/Leadtools.js"></script> 
        <script src="../LT/Leadtools.Controls.js"></script> 
        <script src="../LT/Leadtools.Annotations.Engine.js"></script> 
        <script src="../LT/Leadtools.Annotations.Designers.js"></script> 
        <script src="../LT/Leadtools.Annotations.Rendering.Javascript.js"></script> 
        <script src="../LT/Leadtools.Annotations.Automation.js"></script> 
        <script src="../LT/Leadtools.ImageProcessing.Main.js"></script> 
        <script src="../LT/Leadtools.ImageProcessing.Color.js"></script> 
        <script src="../LT/Leadtools.ImageProcessing.Core.js"></script> 
        <script src="../LT/Leadtools.ImageProcessing.Effects.js"></script> 
        <script src="../LT/Leadtools.Document.js"></script> 
        <script src="../LT/Leadtools.Document.Viewer.js"></script> 
        <script src="../LT/Leadtools.LEADVIEW.js" defer></script> 
        <link href="../css/Leadtools.LEADVIEW.css" type="text/css" rel="stylesheet"> 
 
        <!-- All typescript files compiled from /src/ will be bundled and dropped into the root folder `bundle.js`--> 
        <script src="../bundle.js" type="text/javascript"></script> 
    </head> 
    <body> 
        <div id="runDemo" style="width: 100%; height: 100vh;"></div> 
    </body> 
 
    <script> 
       window.onload = () => { 
         const example = new window.examples.ViewerRunExample(); 
         example.run("runDemo"); 
      }; 
    </script> 
</html> 

Requirements

Target Platforms

Help Version 20.0.2020.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.LEADVIEW Assembly