WeavySpace

Base class for representation of spaces in Weavy.

Kind: global class

Apps

.apps : Array.<WeavyApp>

Array of all the apps defined in the space

Kind: instance property of WeavySpace
Category: apps

.app(options) ⇒ WeavyApp

Selects, fetches or creates an app in the space.

The app needs to be defined using an app definition object containing at least a key, which will fetch or create the app on the server. If the defined app already has been defined, the app will only be selected in the client. After the app is defined it can be quickly selected in the client using only the id (int) or the key (string) of the app, which never will create nor fetch the app from the server.

Kind: instance method of WeavySpace
Category: apps
ParamDescription
options : int : string : options

app id, app key or app definition object.

Example
// Define an app that will be fetched or created on the server
var app = space.app({ key: "mykey", type: "files", container: "#mycontainer" });

// Select the newly defined app
var appAgain = space.app("mykey");

Eventhandling

.on()

Event listener registration for the specific space. Only recieves events that belong to the space or any descendant apps.

Kind: instance method of WeavySpace
Category: eventhandling
Example
weavy.space("myspace").on("open", function(e) { ... })

.one()

One time event listener registration for the specific space. Is only triggered once and only recieves events that belong to the space or any descendant apps.

Kind: instance method of WeavySpace
Category: eventhandling
Example
weavy.space("myspace").one("open", function(e) { ... })

.off()

Event listener unregistration for the specific space.

Kind: instance method of WeavySpace
Category: eventhandling
Example
weavy.space("myspace").off("open", function(e) { ... })

.triggerEvent()

Triggers events on the specific app. The events will also bubble up to the space and then the weavy instance.

Kind: instance method of WeavySpace
Category: eventhandling
Example
weavy.space("myspace").triggerEvent("myevent", [eventData])

Methods

.configure(options, data)

Configure the space with options or data. If the space has data it will also be built. Currently existing options are extended with new options. Data will resolve whenLoaded promise.

Kind: instance method of WeavySpace
Category: methods
Resolves: whenLoaded
Param
options : options
data : data

.fetchOrCreate([options]) ⇒ whenLoaded

Sets options and fetches (or creates) the space on the server. Options will replace existing options. When data is fetched, the whenLoaded promise is resolved.

Kind: instance method of WeavySpace
Category: methods
Resolves: whenLoaded
ParamDescription
[options : options ]

Optional new space options


.build()

Builds the space. Creates a shadow root if needed. Is executed on the build event.

Kind: instance method of WeavySpace
Category: methods
Resolves: whenBuilt

.remove() ⇒ Promise

Removes the space and all it's apps from the client and the DOM. The space will not be removed on the server and can be added and fetched at any point again.

Kind: instance method of WeavySpace
Category: methods

.match(options) ⇒ boolean

Check if another space or an object is matching this space. It checks for a match of the id property or the key property.

Kind: instance method of WeavySpace
Category: methods
ParamDescription
options : WeavySpace : Object
[options.id : int ]

Optional id to match.

[options.key : string ]

Optional key to match.


Options

.options : Object

Options for defining the space. Key (or existing id) is required.

Kind: instance property of WeavySpace
Category: options
Properties
NameDescription
[id : int ]

The server id of the space. Usually only used to reference a specific space on the server.

key : string

The id representing the space in the context environment.

[name : string ]

User readable title for the space.

[description : string ]

Description of the space.

[container : Element : jQuery : string ]

Container for all apps in the space. May be overridden in individual apps.

controls : boolean

Show or hide the panel controls for the apps in the space. May be overridden in individual apps.

tabbed : boolean

Makes the apps in the space act as tabbed, so that only one is open at the time.

apps : Array.<options>

List of app definitions for the space.

Example
weavy.space({
    key: "myspace",
    name: "My space",
    description: "A tabbed space for the team",
    container: "#space-area",
    controls: true,
    tabbed: true,
    apps: [
        { key: "myposts", type: "posts", open:: true },
        { key: "myfiles", type: "files" }
    ]
})

Promises

.whenLoaded : WeavyPromise

Promise that resolves when the space is loaded.

Kind: instance property of WeavySpace
Category: promises

.whenBuilt : WeavyPromise

Promise that resolves when the space is built.

Kind: instance property of WeavySpace
Category: promises

Properties

.id : int

The server id of the space, received from space data.

Kind: instance property of WeavySpace
Category: properties

.name : string

The name of the space, defined in options or received from space data.

Kind: instance property of WeavySpace
Category: properties

.key : string

The key of the space, defined in options or recieved from space data.

Kind: instance property of WeavySpace
Category: properties

.weavy : Weavy

The Weavy instance the space belongs to.

Kind: instance property of WeavySpace
Category: properties

.data : Object

The server data for the space.

Kind: instance property of WeavySpace
Category: properties
Properties
NameDescription
id : int

The server id for the space.

key : string

The client key for the space.

name : string

User readable title for the space.

tags : Array.<string>

List of tags for the space.

thumb : string

Server relative URL to the thumb for the space. {options} must be replaced with thumb options.

apps : Array.<data>

List of data for apps in the space.

[options : options ]

Any space definition sent to the server. Should match options.

Example
{
  id: 1081,
  key: "test-space",
  name: "Test space",
  tags: ["test"],
  thumb: "/spaces/1081/avatar-{options}.svg?v=f2ae1b0",
  apps: [{
    id: 2150,
    guid: "f667c9ee-b1f1-49e6-b32f-8a363f5cdb96",
    key: "notifications",
    name: "Notifications",
    url: "/e/apps/2150",
    typeName: "Weavy.Areas.Apps.Models.Notifications",
    options: {
      key: "notifications",
      type: "notifications"
    }
  }],
  options: {
    key: "test-space",
    name: "Test space"
  }
}

.isLoaded : boolean

Has the space loaded?

Kind: instance property of WeavySpace
Category: properties

.isBuilt : boolean

Is the space built?

Kind: instance property of WeavySpace
Category: properties

.tabbed : boolean

Is the space tabbed? Defined in options. If true only one app will be open at the time in the space.

Defaults to false.

Kind: instance property of WeavySpace
Category: properties