Skip to content

Instantly share code, notes, and snippets.

@freaktechnik
Last active April 26, 2024 22:11
Show Gist options
  • Select an option

  • Save freaktechnik/6249f6d185d74d4e36a33fc0837979fa to your computer and use it in GitHub Desktop.

Select an option

Save freaktechnik/6249f6d185d74d4e36a33fc0837979fa to your computer and use it in GitHub Desktop.
const panel = new Panel({...});
const runLoop = (text, i = 0) => {
// do something
self.port.once("updated-something", runLoop.bind(null, text, i + 1));
self.port.emit("update-something", data);
};
panel.port.on("text-changed", (text) => {
runLoop(text);
});
self.port.on("update-something", (data) => {
// do something with data
self.port.emit("updated-something");
});
self.port.emit("text-changed", text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment