* @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 = () => {},
)
| 26 | * @returns {void} |
| 27 | */ |
| 28 | function 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. |
no test coverage detected