ember-sphere-containers
v0.0.9
Published
Package for sphere engine containers widget integration.
Downloads
17
Maintainers
Readme
ember-sphere-containers
Package for easier management of workspaces for Sphere Engine Containers feature.
Compatibility
- Ember.js v4.8 or above
- Ember CLI v4.8 or above
- Node.js v18 or above
Installation
ember install ember-sphere-containers
Usage
After installing package, in hbs file use Workspace component with workspaceId and optional dataId parameters. If dataId is not given it equals to workspaceId + '-container'.
Adding component:
<Workspace
@workspaceId={{workspaceId}}
/>
Alternative way to add component:
{{workspace workspaceId=@workspaceId }}
Component with custom dataId:
{{workspace workspaceId=@workspaceId dataId="modal-workspace" }}
Then in js file for a component with/above our workspace, import SdkLoader service and in constructor use method .loadSdk().
import SdkLoader from 'ember-sphere-containers/services/sdk-loader';
SdkLoader.loadSdk();
To manipulate workspace import it in the file with our Workspace component:
import Workspace from 'ember-sphere-containers/services/workspace';
After that you can either render, destroy the workspace or subscribe/unsubscribe events:
Workspace.render(this.elemId);
Workspace.destroy(this.elemId);
Workspace.subscribe(this.elemId, event, this.handleEvent);
Workspace.unsubscribe(this.elemId, event, this.handleEvent);
this.elemId corresponds to dataId of the workspace, this.handleEvent is an event handler.