Remoto - VFS: paneFactory Class Reference
Remoto - VFS

The paneFactory dynamically loads pane definitions and registers them to create new pane instances. More...

#include "remoto!stdlib:js/panes/paneFactory.js"

Public Member Functions

 paneFactory (layout, callback)
 Create a pane or paneLoader, and execute the callback once complete. More...
 
 registerType (callback, type, definition)
 Register the results of a loaded definition using a name, which is the pane type. More...
 

Getters & Setters

setter postUpdate
 Assign a callback to the paneFactory class for VFS_node::submit() commands. More...
 
setter postCreate
 Assign a callback to the paneFactory class for VFS create() commands. More...
 
setter postDelete
 Assign a callback to the paneFactory class for VFS_node::rm() commands. More...
 
setter postRequestLock
 Assign a callback to the paneFactory class for VFS_node::requestLock() commands. More...
 
setter postReleaseLock
 Assign a callback to the paneFactory class for VFS_node::releaseLock() commands. More...
 

Detailed Description

The paneFactory dynamically loads pane definitions and registers them to create new pane instances.

This is effectively a static class.

For types that have not been loaded and registered, a paneLoader instance is created. Once the definition has been (asynchronously) loaded, the newly-defined pane is replaces the loader.

Once a pane definition has been registered, future factory requests for that pane type will be directly created instead of using a paneLoader.

See also
paneLoader
registerType()

Constructor & Destructor Documentation

◆ paneFactory()

paneFactory (   layout,
  callback 
)

Create a pane or paneLoader, and execute the callback once complete.

Parameters
layoutThe layout to apply to the new pane, which will contain the pane type.
callbackThe callback for when creation is complete.
Returns
A new pane or paneLoader

This will use the requirejs AMD loader if a type has not been registered yet. If the type mentioned in the layout is not in the form "nodename:libname", "stdlib:js/panes/panes/" will be prepended to the type, which will cause it to load from VFS_stdlib::code().

Note
Note that the pane type must match the filename of the pane in the stdlib if that is the intended use.
See also
paneManager
VFS_creator::code()
VFS_stdlib

Member Function Documentation

◆ postCreate()

setter postCreate

Assign a callback to the paneFactory class for VFS create() commands.

This will generally be vfsClient::postCreate(), and is set in the vfsClient() constructor. Panes can call pane::postCreate(), which will in turn trigger the method assigned here to issue a request to create a node or path in the VFS.

See also
vfsClient
pane::postCreate()
VFS_node::write()
VFS_HD::write()

◆ postDelete()

setter postDelete

Assign a callback to the paneFactory class for VFS_node::rm() commands.

This will generally be vfsClient::postDelete(), and is set in the vfsClient() constructor. Panes can call pane::postDelete(), which will in turn trigger the method assigned here to issue a request to create a node or path in the VFS.

See also
vfsClient
pane::postDelete()
VFS_node::rm()

◆ postReleaseLock()

setter postReleaseLock

Assign a callback to the paneFactory class for VFS_node::releaseLock() commands.

This will generally be vfsClient::postReleaseLock(), and is set in the vfsClient() constructor. Panes can call pane::postReleaseLock(), which will in turn trigger the method assigned here to issue a request to release a lock on a node in the VFS.

See also
vfsClient
pane::postRequestLock()
VFS_node::rm()

◆ postRequestLock()

setter postRequestLock

Assign a callback to the paneFactory class for VFS_node::requestLock() commands.

This will generally be vfsClient::postRequestLock(), and is set in the vfsClient() constructor. Panes can call pane::postRequestLock(), which will in turn trigger the method assigned here to issue a request to gain a lock on a node in the VFS.

See also
vfsClient
pane::postRequestLock()
VFS_node::rm()

◆ postUpdate()

setter postUpdate

Assign a callback to the paneFactory class for VFS_node::submit() commands.

This will generally be vfsClient::postUpdate(), and is set in the vfsClient() constructor. Panes can call pane::postUpdate(), which will in turn trigger the method assigned here to issue a request to submit to a path in the VFS.

See also
vfsClient
pane::postUpdate()
VFS_node::submit()

◆ registerType()

registerType (   callback,
  type,
  definition 
)

Register the results of a loaded definition using a name, which is the pane type.

Parameters
callbackAn optional callback to be called when the pane type has been registered.
typeThe type name as a string
definitionThe result of the retrieved code. This is the return value of the require() callback.

The remoto requirejs loader will have fetched the pane definition over a websocket. We want to keep a reference to the results of that load for potential future instances of the same type.

Because this is called the first time a new pane type is encountered, there is usually a pending callback to satisfy the factory request, which is then called.

Note
Because debugging loader problems can be difficult to track down, an empty or null definition generates a warning but still registers the type. The javascript console will print the type in the warning, but the null/undefined type will cause some other aspect of pane creation to fail.

The documentation for this class was generated from the following file: