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

Function add

src/sidebarApps/index.js:28–45  ·  view source on GitHub ↗

* @param {string} icon icon of the app * @param {string} id id of the app * @param {HTMLElement} el element to show in sidebar * @param {string} title title of the app * @param {(container:HTMLElement)=>(void|Function)} initFunction * @param {boolean} prepend weather to show this app at the top

(
	icon,
	id,
	title,
	initFunction,
	prepend = false,
	onSelected = () => {},
)

Source from the content-addressed store, hash-verified

26 * @returns {void}
27 */
28function add(
29 icon,
30 id,
31 title,
32 initFunction,
33 prepend = false,
34 onSelected = () => {},
35) {
36 currentSection ??= id;
37
38 const app = new SidebarApp(icon, id, title, initFunction, onSelected);
39 apps.push(app);
40 app.install(prepend);
41
42 if (currentSection === id) {
43 setActiveApp(id);
44 }
45}
46
47/**
48 * Removes a sidebar app with the given ID.

Callers 1

loadAppsFunction · 0.70

Calls 2

installMethod · 0.95
setActiveAppFunction · 0.85

Tested by

no test coverage detected