panels ⇒ Weavy.plugins.panels

Creating and handling panels that has frames for app pages. Panels are mostly automatically managed and preloaded when needed.

Kind: global plugin
Example
weavy.on("load", function () {
    if (weavy.isAuthenticated()) {
        weavy.addPanel("space-1", "/spaces/1/", { type: "space"  });
    }
});

Instance members

weavy.nodes ⇐ weavy.nodes

The nodes placeholder in Weavy

Kind: instance property of panels
Extends: weavy.nodes

weavy.nodes.panels : Element

Container for all panels

Kind: instance property of weavy.nodes

weavy.addPanel(panelId, [url], [attributes]) ⇒ Element

Create a panel that has frame handling. If the panel already exists it will return the existing panel.

Kind: instance method of panels
Emits: weavy.panel-added
ParamTypeDescription
panelIdstring

The id of the panel.

[url]url

Optional url. The page will not be loaded until preloadFrame or open is called.

[attributes]Object

All panel attributes are optional

attributes.typestring

Type added as data-type attribute.

attributes.persistentboolean

Should the panel remain when removePanel or clearPanels are called?


weavy.removePanel(panelId, [force])

Removes a panel. If the panel is open it will be closed before it's removed.

Kind: instance method of panels
Emits: weavy.panel-removed
ParamTypeDescription
panelIdstring

The id of the panel to remove

[force]boolean

True will remove the panel even if it's persistent


weavy.clearPanels()

Removes all panels except persistent panels.

Kind: instance method of panels

weavy.renderControls() ⇒ Element

Create panel controls for expand/collapse and close. Set control settings in options

Kind: instance method of panels

weavy.preloadFrame(frameElement, [callback])

Preload a frame. The frame needs to have data-src attribute set instead of src attribute. Panels created using addPanel have the appropriate settings for preload. If the frame belongs to a panel it will triggger loading animations.

Kind: instance method of panels
ParamTypeDescription
frameElementFrameElement

The frame that should be preloaded.

[callback]function

Function called when the frame has loaded


weavy.preloadFrames([force])

Preload all frames. Frames will be loaded sequentially starting with system frames. Preloading is ignored on mobile devices.

Kind: instance method of panels
ParamTypeDescription
[force]boolean

Force preloading for all frames, otherwise only system frames will be preloaded.


Events

"panel-added" ⇒ Object

Triggered when a panel is added

Kind: event emitted by panels
Category: events
Properties
NameTypeDescription
panelElement

The created panel

panelIdstring

The id of the panel

urlurl

The url for the frame.

attributesObject

Panel attributes

attributes.typestring

Type of the panel.

attributes.persistentboolean

Will the panel remain when removePanel or clearPanels are called?


"panel-removed" ⇒ Object

Triggered when a panel has been removed.

Kind: event emitted by panels
Category: events
Properties
NameTypeDescription
panelIdstring

Id of the removed panel


Static members

.defaults : Object

Default plugin options

Kind: static property of panels
Properties
NameTypeDescription
controlsObject

Set to false to disable control buttons

controls.expandboolean

Render a expand/collapse panel control button

controls.closeboolean

Render a close panel control button.

Example
Weavy.plugins.panels.defaults = {
    controls: {
        expand: true,
        close: true
    }
};