Author Watch - adobe/adobe-dx GitHub Wiki
Author watch is a simple tool to detect AEM authoring changes and execute a list of javascript functions against the DOM parent element that was changed.
It was created to:
- Avoid the heavy use of
REFRESH_PAGE
to re-execute javascript. - Avoid writing author-related javascript in visitor-facing code.
- Avoid the use of MutationObserver in visitor-facing code.
<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html">
<sly data-sly-test="${!wcmmode.disabled}" data-sly-call="${clientlib.js @ categories='dx.admin.author'}"></sly>
</sly>
const initMyCoolThing = (element) => {
console.log('my cool thing was edited');
};
window.dx.author.watch.registerFunction(initMyCoolThing);
(does this count as a step three?)