MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / constructor

Method constructor

src/sidebarApps/sidebarApp.js:34–46  ·  view source on GitHub ↗

* Creates a new sidebar app. * @param {string} icon * @param {string} id * @param {string} title * @param {(el:HTMLElement)=>(void|Function)} init * @param {(el:HTMLElement)=>void} onselect

(icon, id, title, init, onselect)

Source from the content-addressed store, hash-verified

32 * @param {(el:HTMLElement)=>void} onselect
33 */
34 constructor(icon, id, title, init, onselect) {
35 const emptyFunc = () => {};
36 this.#container = <div className="container"></div>;
37 this.#icon = <Icon icon={icon} id={id} title={title} />;
38 this.#id = id;
39 this.#title = title;
40 this.#init = init || emptyFunc;
41 this.#onselect = onselect || emptyFunc;
42 const cleanup = this.#init(this.#container);
43 if (typeof cleanup === "function") {
44 this.#cleanup = cleanup;
45 }
46 }
47
48 /**
49 * Installs the app in the sidebar.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected