Cauldron

Cauldron. Cauldron

The Cauldron editor

Constructor

new Cauldron()

Description:
  • Create a new Cauldron editor
Source:

Methods

close()

Description:
  • Closes Cauldron IDE
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.

getPopupParent()

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

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

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

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

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

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

EventSystem:"Cauldron.OnInit"

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

EventSystem:"Cauldron.OnOpen"

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

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