mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 18:58:30 +02:00
✨ Refactor of the plugins context
This commit is contained in:
parent
5a34c25926
commit
127b481c38
12 changed files with 285 additions and 186 deletions
|
@ -1,16 +0,0 @@
|
|||
export class PluginsElement extends HTMLElement {
|
||||
connectedCallback() {
|
||||
console.log('PluginsElement.connectedCallback');
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('penpot-plugins', PluginsElement);
|
||||
|
||||
// Alternative to message passing
|
||||
export function initialize(api) {
|
||||
console.log("PluginsRuntime:initialize", api)
|
||||
|
||||
api.addListener("foobar", "page", (page) => {
|
||||
console.log("Page Changed:", page.name);
|
||||
});
|
||||
};
|
|
@ -23,6 +23,7 @@
|
|||
{{/isDebug}}
|
||||
|
||||
<link rel="icon" href="images/favicon.png" />
|
||||
|
||||
<script type="importmap">
|
||||
{"imports": {"plugins-runtime": "http://localhost:4200/index.mjs"}}
|
||||
</script>
|
||||
|
@ -58,10 +59,7 @@
|
|||
|
||||
<script type="module">
|
||||
import * as runtime from "plugins-runtime";
|
||||
|
||||
// console.log(globalThis.app.plugins);
|
||||
runtime.initialize(globalThis.app.plugins);
|
||||
runtime.initialize(globalThis.app.plugins.api);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue