FoxitPDFSDKforWeb  v10.0.0
Foxit PDF SDK for Web
UIXModule Class Reference

A module constructed by Modular.module is collection of components and controllers. You can register a component class or a controller class into a module then you can use your component in template. An example for registering component class and usage: More...

Public Member Functions

 controller (name, controllerDef)
 
 getPreConfiguredComponent (name)
 
 registerComponent (componentClass)
 
 registerController (ControllerClass)
 
 registerPreConfiguredComponent (name, component)
 

Detailed Description

A module constructed by Modular.module is collection of components and controllers. You can register a component class or a controller class into a module then you can use your component in template. An example for registering component class and usage:

var myModule = UIExtension.modular.module('my-module', []);
var MyComponent = PDFViewCtrl.shared.createClass({
createDOMElement: function() {
return document.createElement('div');
}
}, UIExtension.Component,{
getName: function() {
return 'my-component'
}
});
myModule.registerComponent(MyComponent);
// Now, you can use your component in fragment like following:
new PDFUI({
// ...
fragments: [{
target: 'home-tab-group-hand',
action: UIExtension.UIConsts.FRAGMENT_ACTION.APPEND,
template: '<my-module:my-component></my-module:my-component>'
}]
})

Example for registering controller class and usage:

var myModule = UIExtension.modular.module('my-module', []); // pass [] as second parameter if `'my-module'` had not been created.
var MyController = PDFViewCtrl.shared.createClass({
handle: function() {
console.info('button click');
}
}, UIExtension.Controller, {
getName: function() {
return 'MyController'
}
});
myModule.registerController(MyController);
// Now MyController can be used in layout-template like following:
new PDFUI({
// ...
fragments: [{
target: 'home-tab-group-hand',
action: UIExtension.UIConsts.FRAGMENT_ACTION.APPEND,
template: '<xbutton @controller="my-module:MyController"></xbutton>' // @controller directive pattern: `<module-name>:<controller name returned from 'static getName()'>`
}]
})
See also
Modular::module

Member Function Documentation

◆ controller()

UIXModule::controller (   name,
  controllerDef 
)
inline

Create and register a controller class!

Parameters
namestring - name of the controller which will be used in layout-template
controllerDefobject - Refer to Controller
Returns
UIXModule - this ref

◆ getPreConfiguredComponent()

UIXModule::getPreConfiguredComponent (   name)
inline
Parameters
namestring
Returns
PreConfiguredComponent

◆ registerComponent()

UIXModule::registerComponent (   componentClass)
inline
Parameters
componentClassComponent - UI Component
Returns
UIXModule - this ref

◆ registerController()

UIXModule::registerController (   ControllerClass)
inline
Parameters
ControllerClassController - UI Component
Returns
UIXModule - this ref

◆ registerPreConfiguredComponent()

UIXModule::registerPreConfiguredComponent (   name,
  component 
)
inline
Parameters
namestring
componentPreConfiguredComponent
Returns
UIXModule - this ref

Foxit Software Corporation Logo
@2024 Foxit Software Incorporated. All rights reserved.