@impro.social/impro-plugin 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.js +23 -2
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -109,7 +109,9 @@ export class Menu {
|
|
|
109
109
|
return this.items.map((item) => {
|
|
110
110
|
const handlerId = uuid.create();
|
|
111
111
|
callHandlers.set(handlerId, item._callback);
|
|
112
|
-
|
|
112
|
+
const icon =
|
|
113
|
+
item.icon instanceof VirtualEl ? item.icon._serialize() : item.icon;
|
|
114
|
+
return { title: item.title, icon, handlerId };
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
}
|
|
@@ -309,7 +311,7 @@ export class Plugin {
|
|
|
309
311
|
self.postMessage({
|
|
310
312
|
type: "register",
|
|
311
313
|
target: "sidebarItem",
|
|
312
|
-
icon,
|
|
314
|
+
icon: icon instanceof VirtualEl ? icon._serialize() : icon,
|
|
313
315
|
title,
|
|
314
316
|
handlerId,
|
|
315
317
|
});
|
|
@@ -323,6 +325,18 @@ export class Plugin {
|
|
|
323
325
|
await hostCall("saveData", { data });
|
|
324
326
|
}
|
|
325
327
|
|
|
328
|
+
// Device-local counterpart to loadData/saveData: never synced through the
|
|
329
|
+
// user's account preferences, so it's the right place for anything that
|
|
330
|
+
// shouldn't silently follow the plugin to another device (e.g. a locally
|
|
331
|
+
// held secret key). Cleared on uninstall, same as loadData/saveData.
|
|
332
|
+
async loadLocalData() {
|
|
333
|
+
return hostCall("loadLocalData");
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
async saveLocalData(data) {
|
|
337
|
+
await hostCall("saveLocalData", { data });
|
|
338
|
+
}
|
|
339
|
+
|
|
326
340
|
addSettingTab(tab) {
|
|
327
341
|
tab.plugin = this;
|
|
328
342
|
const displayHandlerId = uuid.create();
|
|
@@ -402,6 +416,13 @@ export class Plugin {
|
|
|
402
416
|
});
|
|
403
417
|
}
|
|
404
418
|
|
|
419
|
+
// Makes every mounted <plugin-slot name=...> re-invoke this plugin's
|
|
420
|
+
// registered callbacks for that slot. Useful when a slot's content depends
|
|
421
|
+
// on data that resolves asynchronously after the initial render.
|
|
422
|
+
refreshSlot(name) {
|
|
423
|
+
return hostCall("refreshSlot", { name });
|
|
424
|
+
}
|
|
425
|
+
|
|
405
426
|
onload() {}
|
|
406
427
|
onunload() {}
|
|
407
428
|
|