Skip to main content

make

static make = (content, icon_src, title, extraClass, contextMenu, makeClone, addPanel = true, addResize = true, onclone = async content => {}) => {

Window.make returns a window Object, that can be added to the page. Before adding it you can modify it.

Arguments:

Content

content can be any element like

var content = document.createElement("div");

You can modify it and send as an argument.

For more details check template sections in demo library.

Icon Source

icon_src is an url to the app icon.

Title

Window title.

Extra Classes

extraClass is an array of strings. All string will be added to the generated window as classes.

["filemanager-window", "wide-window"]
Context menu

Any window may have a custom context menu. It's optional.

If there's no context menu, demo will use the default one.

Example:

[
...ContextMenu.defaultMenu,
{
"type" : "plain",
"icon" : ContextIcons.download,
"text" : "Download"
},
{
"type" : "split",
},
{
"type" : "plain",
"icon" : ContextIcons.close,
"text" : "Close"
},
]
Make Clone

Bool flag. It's used to clone content and add it to multiple windows. (cloning objects makes them static and drops events).

For more details check Listener Adder.

Add Panel

Bool flag. false to disable topbar. It will also change window class from window to static-window.

Add Resize

Bool flag. false to disable resizing.

Listener Adder

listenerAdder is a function, that gets content (after cloning). You can modify this content and it will be applied to the generated window.

It allows to overpass cloning limitations and make windows dynamic.

Simple window example:

Window.make(filemanager_content, "src/image/filemanager.jpg",  "Filemanager");

Adding window to the body:

Workspace.add(Window.make(filemanager_content, "src/image/filemanager.jpg",  "Filemanager"));

For more info about how to create an app, go to the template sections in demo library.