CauldronBase

Cauldron~ CauldronBase

The Cauldron editor

Constructor

new CauldronBase()

Source:
Create a new Cauldron editor

Methods

close()

Source:
Closes Cauldron IDE

createComponent(componentName, stateopt, allowMultipleInstancesopt)

Source:
Create a component with the given name and state
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.

isOpen() → {boolean}

Source:
Check wether this Cauldron editor is open
Returns:
true/false depending on if Cauldron is open or not
Type
boolean

(async) open()

Source:
Opens Cauldron IDE

(async) registerComponent(componentName, creator)

Source:
Register a component with Cauldron
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:
Name Type Description
componentName String The name of the component
creator Cauldron.Cauldron~creatorCallback

setBounds(x, y, width, height)

Source:
Sets the bounds of this Cauldron
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

creatorCallback(state) → {Cauldron.Cauldron~creatorCallbackResult|Element}

Source:
This callback is used to create components
Parameters:
Name Type Description
state object The state of the component
Returns:
Type
Cauldron.Cauldron~creatorCallbackResult | Element

creatorCallbackResult

Source:
Properties:
Name Type Attributes Description
dom Element The dom element of the component
serializer Cauldron.Cauldron~serializer <optional>
Serializer to use when state cannot serialize correctly using JSON stringify/parse
onResize Cauldron.Cauldron~componentResizedCallback <optional>
Callback that is called when component is resized
onTab Cauldron.Cauldron~tabCreatedCallback <optional>
Callback that is called when component has a tab created
onDestroy Cauldron.Cauldron~componentDestroyCallback <optional>
Callback that is called when component is destroyed
onShow Cauldron.Cauldron~componentShowCallback <optional>
Callback that is called when component is shown
Represents the result of a component creator function
Type:
  • object

serializer

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:
  • object

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"

Source:
Properties:
Name Type Description
cauldron Cauldron.Cauldron The Cauldron that was closed
Triggered when a Cauldron is closed.
Type:
  • Event

EventSystem:"Cauldron.OnInit"

Source:
Properties:
Name Type Description
cauldron Cauldron.Cauldron The Cauldron that was initialized
Triggered when a Cauldron is initialized.
Type:
  • Event

EventSystem:"Cauldron.OnOpen"

Source:
Properties:
Name Type Description
cauldron Cauldron.Cauldron The Cauldron that was opened
Triggered when a Cauldron is opened.
Type:
  • CustomEvent

EventSystem:"Cauldron.Open.FragmentEditor"

Source:
Properties:
Name Type Description
fragment Fragment The fragment to open in a FragmentEditor
Tirgger to open a FragmentEditor
Type:
  • Event