Addon ID

  • masterpose_domside

Info

Statistics

  • Download count33 total downloads
  • Latest download count 33 downloads of latest version
  • Average download count1 downloads per day average

Owners

With this plugin you can load scripts directly to the DOM Side and communicate with the Web Worker using a simple API of events and procedure calls.

The first thing you should do is to create a new JavaScript file inside your files/ folder (no scripts/). Then load it with a simple action.

Inside your loaded script, you have full DOM APIs and you can edit the HTML as you want.

// DOM Side
console.log("Hello I'm the DOM Side, look I have a document body!", document.body)
const $p = document.createElement('p');
$p.innerText = 'UI Started';
$p.style.position = 'absolute'
$p.style.top = '0'
$p.style.left = '0'
$p.style.padding = '4px'
$p.style.margin = '0px'
$p.id = 'ui-' + Math.floor(Math.random() * 1000);
document.body.appendChild($p);

The DOM Side doesn't have reference of your runtime that lives on the Web Worker. So you must communicate between these two sides using the available EventSheet ACEs or the scripting DomSideHandler global object that is available on both sides.

You can learn more in masterpose.itch.io/primitives-c3/devlog/1130019/new-dom-side-plugin