Class idx.PlatformPluginRegistry
Provides a registry for platform-specific plugins for
implementing multi-channel widgets based on a module name.
Plugin registries are created via the static "register"
method rather than by constructing them. In fact, constructed
instances will not function if they were not created by the
"register" function.
Defined in: <idx\PlatformPluginRegistry.js>.
Constructor Summary
Constructor Attributes | Constructor Name and Description |
---|---|
Field Summary
Field Attributes | Field Name and Description |
---|---|
<static> |
idx.PlatformPluginRegistry.moduleName
The name of the module for which the registry exists.
|
<static> |
idx.PlatformPluginRegistry.targetPlatform
The target platform to be used by all widgets that leverage this registry.
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
<static> |
idx.PlatformPluginRegistry.constructor(args)
Constructor.
|
<static> |
idx.PlatformPluginRegistry.getAutoPlatform()
Returns the actual platform that will be used when the "auto" platform setting is employed.
|
<static> |
idx.PlatformPluginRegistry.getGlobalTargetPlatform(requester)
Obtains the global default platform that is being used as the default across all registries.
|
<static> |
idx.PlatformPluginRegistry.getPlugin(requester, forceSync)
Returns a promise that will resolve to the global plugin instance
for the optionally specified requester that typically implements _PlatformPlugableMixin.
|
<static> |
idx.PlatformPluginRegistry.getPluginModule(requester)
Returns the promise for the plugin module for the optionally specified requesting
widget that typically implements _PlatformPlugableMixin.
|
<static> |
idx.PlatformPluginRegistry.getPluginModuleName(requester)
Returns the name for the specified requesting requester that implements
_PlatformPlugableMixin.
|
<static> |
idx.PlatformPluginRegistry.onDefaultPlatformChange(registry, oldPlatform, newPlatform, oldPlugin, newPlugin)
This method is called when the global platform changes.
|
<static> |
idx.PlatformPluginRegistry.register(baseModuleName, loadedPluginModules, customPluginNames)
Creates a plugin registry for the specified module name.
|
<static> |
idx.PlatformPluginRegistry.resolveTargetPlatform(requester)
Determines the target platform to use given the optionally specified widget-specific
target platform.
|
<static> |
idx.PlatformPluginRegistry.setAutoPlatform()
Returns the platform that will be used when a setting of "auto" is used for the
target platform settings.
|
<static> |
idx.PlatformPluginRegistry.setGlobalPlatform()
Returns the global default target platform.
|
<static> |
idx.PlatformPluginRegistry.setGlobalTargetPlatform(platform)
Sets the global default program that is used as the default across all registries.
|
<static> |
idx.PlatformPluginRegistry.setRegistryDefaultPlatform(baseModuleName, defaultPlatform)
Sets the default platform for a registry even BEFORE it is created.
|
<static> |
idx.PlatformPluginRegistry.setRegistryTargetPlatform(baseModuleName, targetPlatform)
Sets the target platform for a registry associated with the sepcified
module AFTER it has been created/registered by its associated module.
|
Constructor Detail
idx.PlatformPluginRegistry()
define(["idx/PlatformPluginRegistry"], function(MPR) { var registry = MPR.register("idx/app/Header"); ... });
Field Detail
<static> idx.PlatformPluginRegistry.moduleName
The name of the module for which the registry exists.
<static> idx.PlatformPluginRegistry.targetPlatform
The target platform to be used by all widgets that leverage this registry.
The order of precedence for determining the target platform is first
widget specific, then registry-specific, then using the global platform.
Method Detail
<static> idx.PlatformPluginRegistry.constructor(args)
Constructor.
- Parameters:
- args
<static> idx.PlatformPluginRegistry.getAutoPlatform()
Returns the actual platform that will be used when the "auto" platform setting is employed.
This will return one of "desktop", "tablet" or "phone".
- Returns:
- The platform that the "auto" platform resolves to.
<static> idx.PlatformPluginRegistry.getGlobalTargetPlatform(requester)
Obtains the global default platform that is being used as the default across all registries.
- Parameters:
- requester
- The optional reference to the requesting widget for tracking of changes.
<static> idx.PlatformPluginRegistry.getPlugin(requester, forceSync)
Returns a promise that will resolve to the global plugin instance
for the optionally specified requester that typically implements _PlatformPlugableMixin.
If no requester is specified then the registry default platform will be
resolved for obtaining the plugin promise.
This method will execute synchronously if the specified requester has not yet had its
startup() function called (i.e.: requester._started !== true). Further, if the
optional second parameter for "forceSync" is set to true, then it will be synchronous.
- Parameters:
- requester
- forceSync
- Returns:
- The instance of the appropriate plugin to be used.
<static> idx.PlatformPluginRegistry.getPluginModule(requester)
Returns the promise for the plugin module for the optionally specified requesting
widget that typically implements _PlatformPlugableMixin. If no requester is specified
then the registry default platform is used to resolve the plugin module.
- Parameters:
- requester
- Returns:
- The promise for resolving the loaded plugin module.
<static> idx.PlatformPluginRegistry.getPluginModuleName(requester)
Returns the name for the specified requesting requester that implements
_PlatformPlugableMixin. If no requester is specified then the registry default
platform is resolved.
- Parameters:
- requester
- Returns:
- The name for the plugin module.
<static> idx.PlatformPluginRegistry.onDefaultPlatformChange(registry, oldPlatform, newPlatform, oldPlugin, newPlugin)
This method is called when the global platform changes.
- Parameters:
- registry
- The PlatformPluginRegistry.
- oldPlatform
- The old platform.
- newPlatform
- The new platform.
- oldPlugin
- The old plugin.
- newPlugin
- The new plugin (which may be the same).
<static> idx.PlatformPluginRegistry.register(baseModuleName, loadedPluginModules, customPluginNames)
Creates a plugin registry for the specified module name. Note, when specifying
the "loadedPluginModules" or "customPluginNames" parameters, the psuedo-platform of "mobile"
can be used to set a default plugin or plugin module name (respectively) for both tablet and
phone platforms if not otherwise specified.
- Parameters:
- baseModuleName
- The name of the master module that will use the plugins. The names of the plugin modules will be inferred from this if not provided.
- loadedPluginModules
- A map of valid platform names (e.g.: "desktop", "tablet" or "phone") to plugin modules that have already been loaded. Typically this contains null values for unloaded plugin modules and a real value for the default platform module. If a field is missing from this object then it is assumed that such a plugin does not exist for that widget.
- customPluginNames
- A map of valid platform names (e.g.: "desktop", "tablet" or "phone") to the names for finding and loading the plugin modules. This is optional and if not provided, the names are inferred from the base module name.
- Returns:
- The PlatformPluginRegistry that was just created or previously created for the specified base module name.
<static> idx.PlatformPluginRegistry.resolveTargetPlatform(requester)
Determines the target platform to use given the optionally specified widget-specific
target platform. If the specified target platform is a valid non-empty string then it
is used. If not, then an attempt is made to use the
- Parameters:
- requester
<static> idx.PlatformPluginRegistry.setAutoPlatform()
Returns the platform that will be used when a setting of "auto" is used for the
target platform settings.
<static> idx.PlatformPluginRegistry.setGlobalPlatform()
Returns the global default target platform. The possible return values are
"desktop", "tablet", "phone" or "auto". The global target platform will never
be empty-string or null. By default, the global target platform is set to "desktop".
- Returns:
- The global default target platform.
<static> idx.PlatformPluginRegistry.setGlobalTargetPlatform(platform)
Sets the global default program that is used as the default across all registries.
- Parameters:
- platform
- The platform to set as the global default (e.g.: "desktop", "tablet", "phone" or "auto")
<static> idx.PlatformPluginRegistry.setRegistryDefaultPlatform(baseModuleName, defaultPlatform)
Sets the default platform for a registry even BEFORE it is created.
A warning is issued if this is called AFTER the register has been created
and registered since this method will have no effect in such a case.
- Parameters:
- baseModuleName
- The name of the master module with which the registry is associated.
- defaultPlatform
- The name of the default platform for the associated registry once it becomes registered (e.g.: "desktop", "tablet", "phone" or "auto").
<static> idx.PlatformPluginRegistry.setRegistryTargetPlatform(baseModuleName, targetPlatform)
Sets the target platform for a registry associated with the sepcified
module AFTER it has been created/registered by its associated module.
A warning is issued if this is called BEFORE the registry has been created
and registered since this method will have no effect in such a case.
- Parameters:
- baseModuleName
- The name of the master module with which the registry is associated.
- targetPlatform
- The name of the target platform for the associated registry (e.g.: "desktop", "tablet", "phone" or "auto").