const { Plugins, Actions, log, EventEmitter } = require('./utils/plugin'); const { execSync } = require('child_process'); const plugin = new Plugins('demo'); plugin.didReceiveGlobalSettings = ({ payload: { settings } }) => { log.info('didReceiveGlobalSettings', settings); }; const createSvg = (text) => ` ${text} `; const timers = {}; plugin.demo = new Actions({ default: { }, async _willAppear({ context, payload }) { // log.info("demo: ", context); let n = 0; timers[context] = setInterval(async () => { const svg = createSvg(++n); plugin.setImage(context, `data:image/svg+xml;charset=utf8,${svg}`); }, 1000); }, _willDisappear({ context }) { // log.info('willDisAppear', context) timers[context] && clearInterval(timers[context]); }, _propertyInspectorDidAppear({ context }) { }, sendToPlugin({ payload, context }) { }, keyUp({ context, payload }) { }, dialDown({ context, payload }) {}, dialRotate({ context, payload }) {} });