initial for v1

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-07-28 00:05:32 +02:00
committed by Carl-Gerhard Lindesvärd
parent c770634e73
commit 15e997129a
23 changed files with 1019 additions and 528 deletions

View File

@@ -0,0 +1,27 @@
import { OpenPanel } from './index';
((window) => {
if (window.op && 'q' in window.op) {
const queue = window.op.q || [];
// @ts-expect-error
const op = new OpenPanel(queue.shift()[1]);
queue.forEach((item) => {
if (item[0] in op) {
// @ts-expect-error
op[item[0]](...item.slice(1));
}
});
window.op = (t, ...args) => {
const fn = op[t] ? op[t].bind(op) : undefined;
if (typeof fn === 'function') {
// @ts-expect-error
fn(...args);
} else {
console.warn(`op.js: ${t} is not a function`);
}
};
window.openpanel = op;
}
})(window);