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... | |
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.
paneFactory | ( | layout, | |
callback | |||
) |
Create a pane or paneLoader, and execute the callback once complete.
layout | The layout to apply to the new pane, which will contain the pane type. |
callback | The callback for when creation is complete. |
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().
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.
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.
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.
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.
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.
registerType | ( | callback, | |
type, | |||
definition | |||
) |
Register the results of a loaded definition using a name, which is the pane type.
callback | An optional callback to be called when the pane type has been registered. |
type | The type name as a string |
definition | The 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.