-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrenderer.js
More file actions
63 lines (57 loc) · 1.73 KB
/
Copy pathrenderer.js
File metadata and controls
63 lines (57 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/// <reference types="@qwqnt/types/renderer" />
import {
scriptio,
scriptHelper,
onVueComponentMount,
onVueComponentUnmount,
} from "./modules/renderer/javascript.js";
Object.defineProperty(window, "scriptio", {
value: scriptio,
writable: false,
enumerable: true,
configurable: false,
});
Object.defineProperty(window, "scriptio_toolkit", {
// Kept for compatibility - will be deprecated.
value: scriptio,
writable: false,
enumerable: true,
configurable: false,
});
scriptio_internal.onUpdateScript((event, args) => {
scriptHelper(
args.path,
args.code,
args.enabled,
args.meta.description,
args.meta["run-at"],
);
});
scriptio_internal.rendererReady();
/**
* Called when the settings window is created.
* @param {Element} view The settings view element.
*/
async function onSettingWindowCreated(view) {
const { initScriptioSettings, scriptioSettingsUpdateScript } =
await import("./modules/renderer/settings.js");
const container = await initScriptioSettings(view);
scriptio_internal.onUpdateScript((event, args) => {
scriptioSettingsUpdateScript(container, args);
});
scriptio_internal.rendererReady(); // // Call again to ensure the settings view gets the scripts data.
}
// https://github.com/qwqnt-community/qwqnt-hako
PluginSettings.renderer
.registerPluginSettings(qwqnt.framework.plugins.scriptio.meta.packageJson)
.then((view) => {
if (view) {
onSettingWindowCreated(view);
}
});
window.addEventListener("vue:component-mount", (e) => {
onVueComponentMount(e.detail);
});
window.addEventListener("vue:component-unmount", (e) => {
onVueComponentUnmount(e.detail);
});