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-onlyid
Type:Number

The id of the workspace.

read-onlyname
Type:String

The name of the workspace.

read-onlystate
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:
  1. 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:
  1. 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:
  1. 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-memberload(callback)

Loades the workspaces from the DB and registers for the socket event redistribution.

Callback args:
  1. err (String|null) – null on success else the error description.
class-membergetId(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-memberbyId(id)

Retrieves the workspace by id.

Returns:the workspace or null if there no workspace for the id given
Return type:Workspace
class-memberbyName(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-memberworkspaces
Type:Ojbect(id => Workspace)

The workspace directory (id => workspace). Safe against alteration.

workspaceCount
Type:Number

The number of workspaces.

class-membercreateNew(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:
  1. err (String|null) – The error information or null if is was a sucess.
  2. workspace (Workspace) – The newly created workspace.