Package for easier management of workspaces for Sphere Engine Containers feature.
- Ember.js v4.8 or above
- Ember CLI v4.8 or above
- Node.js v18 or above
ember install ember-sphere-containers
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:
Alternative way to add component:
Component with custom dataId:
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.