If I’m using UDT and make a change in VSCode, and I have watch on, is there a way to tell that the plugin has been reloaded? Is there a load or reload event that I can listen for?
Or can I have Adobe XD or UDT show a desktop notification or play a sound when the plugin is reloaded?
You can use require("uxp").entrypoints to get notified.
const entrypoints = require("uxp").entrypoints;
entrypoints.setup({
plugin: {
create() {
// called on load/reload
const item = sessionStorage.getItem('pageHasBeenLoaded');
if (item) {
console.log('this is a reload');
// do something to notify user
const dialog = document.createElement("dialog");
dialog.innerHTML = "<div><h1>This is page reload</h1></div>";
document.body.appendChild(dialog);
dialog.show();
}
sessionStorage.setItem('pageHasBeenLoaded', 'true');
console.log("created", this);
},
destroy() {
// called only on unload
sessionStorage.removeItem('pageHasBeenLoaded');
console.log("destroyed");
}
}
}