Workspace¶
-
class
Workspace
(config)¶ Extends: Emitter Mixins: LoggerInferface The abstract representation of a workspace and it’s functions.
Warning
This class is not to be instanciated manually. Instead use its class-members functions.
Arguments: - config (Object) – The configuration of the workspace.
-
read-only
id
¶ Type: Number The id of the workspace.
-
read-only
name
¶ Type: String The name of the workspace.
-
read-only
state
¶ Type: String The connectivity state of the workspace. Possible values are: - disconnected - requestedConnect - connecting - connected - requestedDisonnect - disconnecting
Emits stateChanged: If this value changed.
-
color
¶ Type: String The assigned color of this workspace.
-
connect
([, callback[, password]])¶ Connect the workspace.
Callback args: - err (String|null) – Will contain the error description or null if the connect was successfull. Consider using the connected event instead.
Arguments: - password (String) – May contain the password/SSH passphrase used for connecting.
-
disconnect
([, callback])¶ Disconnects the workspace.
Callback args: - err (String|null) – Will contain the error description or null if the disconnect was successfull. Consider using the disconnected event instead.
-
edit
(newConfig[, callback[, connect]])¶ Edit a current workspace. Will be disconnected if it is not already.
Arguments: - newConfig (Object) – The new config for the workspace.
- newConfig.name (String) – The new workspace name.
- newConfig.host (String) – The new host name.
- newConfig.login (String) – The new login user name.
- newConfig.key (String) – The new private key used for authentification.
- newConfig.command (String) – The new command.
- connect (Bool) – Connect when edit has finished.
Callback args: - err (String|null) – Will contain the error description or null.
-
remove
([, callback])¶ Removes the workspace. A success implies the destruction of the instance and it must not be used thereafter.
callback String|null err: Will contain the error description or null if the remove was successfull
-
closeAllInstances
()¶ Forces all known open instances to be closed. This is syncronus.
-
initPrefs
()¶ Registers the preferences with vispa.preferences.
-
class-member
load
(callback)¶ Loades the workspaces from the DB and registers for the socket event redistribution.
Callback args: - err (String|null) – null on success else the error description.
-
class-member
getId
(workspace, fallback)¶ Retrieves the workspace id if possible or return the fallback value.
Arguments: - workspace (Workspace|Number) – A Workspace instance or a valud workspace id.
- fallback (any) – The fallback value.
Returns: The workspace if available or the fallback value.
Return type: Number
-
class-member
byId
(id)¶ Retrieves the workspace by id.
Returns: the workspace or null if there no workspace for the id given Return type: Workspace
-
class-member
byName
(name)¶ Retrieves the first workspace with the given name.
Returns: the workspace or null if there no such workspace Return type: Workspace
-
current
¶ Type: Workspace|null The current workspace. This is the workspace new vies might be bound to - it is not the workspace of the currently active view/thread.
-
read-only class-member
workspaces
¶ Type: Ojbect(id => Workspace) The workspace directory (id => workspace). Safe against alteration.
-
workspaceCount
¶ Type: Number The number of workspaces.
-
class-member
createNew
(config[, callback])¶ Create a new workspace and saves it.
Arguments: - config (Object) – A plain object holding the informations for the new Workspace.
See
Workspace()
constructor argument.
Callback args: - err (String|null) – The error information or null if is was a sucess.
- workspace (Workspace) – The newly created workspace.
- config (Object) – A plain object holding the informations for the new Workspace.
See