Constructor
new Cauldron()
- Description:
- Create a new Cauldron editor
- Source:
Methods
close()
- Description:
- Source:
(async) createComponent(componentName, stateopt, allowMultipleInstancesopt)
- Description:
- Create a component with the given name and state
- Source:
Example
createComponent("MyComponent", {
someState: "ImportantStateData"
});
Parameters:
Name |
Type |
Attributes |
Default |
Description |
componentName |
String
|
|
|
|
state |
object
|
<optional>
|
|
|
allowMultipleInstances |
boolean
|
<optional>
|
false
|
Determines if multiple components with the same state are allowed, if set to true a new component will always be created. If false and a component with the same state already exists, then that component will be selected instead. |
- Description:
- The parent element to insert popups and overlays into when opening menus etc
- Source:
Returns:
element
isOpen() → {boolean}
- Description:
- Check wether this Cauldron editor is open
- Source:
Returns:
true/false depending on if Cauldron is open or not
-
Type
-
boolean
(async) open()
- Description:
- Opens Cauldron IDE
Optionally inside another element
- Source:
(async) registerComponent(componentName, creator)
- Description:
- Register a component with Cauldron
- Source:
Examples
registerComponent("MyComponent", (state)=>{
let myComponentDom = document.createElement("div");
myComponentDom.textContent = state.someState;
return myComponentDom;
});
registerComponent("MyComponent", (state)=>{
let myComponentDom = document.createElement("div");
myComponentDom.textContent = state.someState;
return {
dom: myComponentDom,
onResize: ()=>{
//The component has been resized, do something
},
onTab: (tab)=>{
//The component has created a tab, do something to it
},
onShow: ()=>{
//Called when the component is made visible, ie. its tab is switched to
},
onDestroy: ()=>{
//Called when the component is destroyed
}
};
});
registerComponent("MyComponent", (state)=>{
let myComponentDom = document.createElement("div");
myComponentDom.textContent = state.someState;
return {
dom: myComponentDom,
//Setup serializer to handle state that cannot JSON stringify/parse correctly
serializer: {
serialize: (state)=>{
//Serialize all state that cannot JSON stringify/parse correctly
},
deserialize: (state)=>{
//Deserialize all state that cannot JSON stringify/parse correctly
}
}
};
});
Parameters:
setBounds(x, y, width, height)
- Description:
- Sets the bounds of this Cauldron
- Source:
Parameters:
Name |
Type |
Description |
x |
Number
|
|
y |
Number
|
|
width |
Number
|
|
height |
Number
|
|
Type Definitions
componentDestroyCallback(container)
- Source:
Parameters:
Name |
Type |
Description |
container |
object
|
The Golden Layout container |
componentResizedCallback(container)
- Source:
Parameters:
Name |
Type |
Description |
container |
object
|
The Golden Layout container |
componentShowCallback(container)
- Source:
Parameters:
Name |
Type |
Description |
container |
object
|
The Golden Layout container |
- Description:
- This callback is used to create components
- Source:
Parameters:
Name |
Type |
Description |
state |
object
|
The state of the component |
Returns:
-
Type
-
Cauldron.Cauldron~creatorCallbackResult
|
Element
creatorCallbackResult
- Description:
- Represents the result of a component creator function
- Source:
Properties:
Represents the result of a component creator function
Type:
serializer
- Description:
- This object is used to describe the serialize / deserialize of component state that cannot serialize correctly
using only JSON stringify/parse.
- Source:
Properties:
Name |
Type |
Description |
serialize |
function
|
|
deserialize |
function
|
|
This object is used to describe the serialize / deserialize of component state that cannot serialize correctly
using only JSON stringify/parse.
Type:
tabCreatedCallback(tab, container)
- Source:
Parameters:
Name |
Type |
Description |
tab |
object
|
The tab that was created |
container |
object
|
The Golden Layout container |
Events
EventSystem:"Cauldron.OnClose"
- Description:
- Triggered when a Cauldron is closed.
- Source:
Properties:
Type:
EventSystem:"Cauldron.OnInit"
- Description:
- Triggered when a Cauldron is initialized.
- Source:
Properties:
Type:
EventSystem:"Cauldron.OnOpen"
- Description:
- Triggered when a Cauldron is opened.
- Source:
Properties:
Type:
EventSystem:"Cauldron.Open.FragmentEditor"
- Description:
- Tirgger to open a FragmentEditor
- Source:
Properties:
Name |
Type |
Description |
fragment |
Fragment
|
The fragment to open in a FragmentEditor |
Type: