diff --git a/common/src/app/common/record.cljc b/common/src/app/common/record.cljc index f9d10df0c..f5ac3a39d 100644 --- a/common/src/app/common/record.cljc +++ b/common/src/app/common/record.cljc @@ -430,15 +430,18 @@ (defmacro define-properties! [rsym & properties] - (let [rsym (with-meta rsym {:tag 'js})] + (let [rsym (with-meta rsym {:tag 'js}) + self-sym (gensym "self-") + get-fn-sym (gensym "get-fn-") + set-fn-sym (gensym "set-fn-") + params-sym (gensym "params-") + args-sym (gensym "args-")] `(do ~@(for [params properties :let [pname (get params :name) get-fn (get params :get) set-fn (get params :set)]] - `(.defineProperty js/Object - (.-prototype ~rsym) - ~pname + `(.defineProperty js/Object (.-prototype ~rsym) ~pname (cljs.core/js-obj "enumerable" true "configurable" true @@ -447,4 +450,3 @@ ["get" get-fn]) (when set-fn ["set" set-fn])))))))) - diff --git a/frontend/resources/public/js/plugins-runtime.mjs b/frontend/resources/public/js/plugins-runtime.mjs new file mode 100644 index 000000000..2651e233b --- /dev/null +++ b/frontend/resources/public/js/plugins-runtime.mjs @@ -0,0 +1,16 @@ +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); + }); +}; diff --git a/frontend/resources/templates/index.mustache b/frontend/resources/templates/index.mustache index 9090976a3..138f244f5 100644 --- a/frontend/resources/templates/index.mustache +++ b/frontend/resources/templates/index.mustache @@ -23,6 +23,11 @@ {{/isDebug}} + + + - - + + {{/manifest}} @@ -44,8 +49,19 @@
{{# manifest}} - - + + + + +