Материал из Module developer
Перейти к: навигация, поиск

>> Getting access to the module:
If you want access to resources of a module use the function B.getModule, which returns a description of the module. This is necessary due to the particular architecture i3 lite application that can have a large number of modules.
MyModule = B.getModule (ModuleID);
For example, it is possible to gain access to the module via popup function getPopup:

IR.AddListener (IR.EVENT_MODULE_START, 0, function (ModuleID) {
Module = B.getModule (ModuleID); // Get access to the module
        popup = Module.getPopup ("MyPopup"); // Get access to the popup module
        IR.AddListener (IR.EVENT_ITEM_PRESS, popup.GetItem ("Button"), function () {// The listener module
             IR.Log ("Hello World");
        })
});

Thus, a script is outputting to a log message when you click "Button".