Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "PluginApi/UIManager"

Index

Classes

Interfaces

Functions

Functions

registerUI

  • registerUI(id: string, ctor: object): void
  • Registers custom UI manager.

    Custom UI manager class passed to second parameter of this function must extend UIManager class.

    Example (JavaScript):

    require(["PluginApi/UIManager"], function(UIManager) {
    
        var MyCustomUI = function(builder) {
            UIManager.UIManager.call(this, builder);
            var builderCanvas = $('<div id="builder_canvas"/>');
            $(document.body).append(builderCanvas);
            builder.init(builderCanvas);
        }
        MyCustomUI.prototype = Object.create(UIManager.UIManager.prototype);
        MyCustomUI.prototype.constructor = MyCustomUI;
    
        UIManager.registerUI(pluginData.id, MyCustomUI);
    });

    Example (TypeScript):

    import {UIManager, registerUI} from "PluginApi/UIManager";
    import {PluginGlobalLoadingData} from "PluginApi/Types";
    
    declare let pluginData: PluginGlobalLoadingData;
    
    class MyCustomUI extends UIManager {
        constructor(builder: BuilderApi) {
            super(builder);
            let builderCanvas = $('<div id="builder_canvas"/>');
            $(document.body).append(builderCanvas);
            builder.init(builderCanvas);
        }
    }
    
    registerUI(pluginData.id, MyCustomUI);

    Parameters

    • id: string

      ID of custom UI. Usually it is same as plugin id retrieved from global variable pluginData (see PluginGlobalLoadingData).

    • ctor: object

      Constructor of custom UI manager class (class itself instead of an instance). The constructor will receive an instance of BuilderApi class in its first parameter, which can be used to initialize and control builder.

    Returns void