Class Crocodoc.Scope


Defined in: <ecm\widget\viewer\crocodoc\viewer.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 
Crocodoc.Scope(config)
Scope class used for component scoping (creating, destroying, broadcasting messages)

Method Summary

Method Attributes Method Name and Description
 
broadcast(name, data)
Broadcast a message or queue it until the viewer is ready
 
createComponent(componentName)
Create and return an instance of the named component, and add it to the list of instances in this scope
 
Remove and call the destroy method on all instances in this scope
 
destroyComponent(instance)
Remove and call the destroy method on a component instance
<inner>  
destroyComponent(instance)
Call the destroy method on a component instance if it exists and the instance has not already been destroyed
 
get(objectType, objectKey)
Get a model object from a data provider.
 
Get the config object associated with this scope
 
getDataProvider(objectType)
Get an instance of a data provider.
 
getUtility(name)
Passthrough method to the framework that retrieves utilities.
 
Tell the scope that the viewer is ready and broadcast queued messages

Constructor Detail

Crocodoc.Scope(config)

Scope class used for component scoping (creating, destroying, broadcasting messages)
Parameters:
config

Method Detail

{void} broadcast(name, data)

Broadcast a message or queue it until the viewer is ready
Parameters:
{string} name
The name of the message
{*} data
The message data
Returns:
{void}

{?Object} createComponent(componentName)

Create and return an instance of the named component, and add it to the list of instances in this scope
Parameters:
{string} componentName
The name of the component to create
Returns:
{?Object} The component instance or null if the component doesn't exist

{void} destroy()

Remove and call the destroy method on all instances in this scope
Returns:
{void}

{void} destroyComponent(instance)

Remove and call the destroy method on a component instance
Parameters:
{Object} instance
The component instance to remove
Returns:
{void}

<inner> {void} destroyComponent(instance)

Call the destroy method on a component instance if it exists and the instance has not already been destroyed
Parameters:
{Object} instance
The component instance
Returns:
{void}

{$.Promise} get(objectType, objectKey)

Get a model object from a data provider. If the objectType is listed in config.dataProviders, this will get the value from the data provider that is specified in that map instead.
Parameters:
{string} objectType
The type of object to retrieve ('page-svg', 'page-text', etc)
{string} objectKey
The key of the object to retrieve
Returns:
{$.Promise}

{Object} getConfig()

Get the config object associated with this scope
Returns:
{Object} The config object

{Object} getDataProvider(objectType)

Get an instance of a data provider. Ignores config.dataProviders overrides.
Parameters:
{string} objectType
The type of object to retrieve a data provider for ('page-svg', 'page-text', etc)
Returns:
{Object} The data provider

{?Object} getUtility(name)

Passthrough method to the framework that retrieves utilities.
Parameters:
{string} name
The name of the utility to retrieve
Returns:
{?Object} An object if the utility is found or null if not

{void} ready()

Tell the scope that the viewer is ready and broadcast queued messages
Returns:
{void}