Skip to main content

Scripts

Introduction#

The Hello7 format allows to add custom JavaScript code to the templates. This is mostly useful to catch specific events like the template load, the selection or update of a layer or property from the Studio, etc.

The scripts should be inserted in tge scripts.js file and respect the JavaScript reference.

Available events#

EventParametersFired when
hello7LoadThe template is loaded
hello7LayerInitid, valueA layer is initialized
hello7LayerSelectid, valueA layer is selected from the Studio
hello7LayerUpdateid, valueA layer is updated from the Studio
hello7PropertyInitid, valueA property is initialized
hello7PropertyUpdateid, valueA property is updated from the Studio

Example#

window.addEventListener("hello7Load", function (e) {
console.log("hello7Load");
}, false);
window.addEventListener("hello7LayerInit", function (e) {
console.log("hello7LayerInit\n%c" + JSON.stringify(e.detail), "color: red");
checkForLyon();
}, false);
window.addEventListener("hello7LayerSelect", function (e) {
console.log("hello7LayerSelect\n%c" + JSON.stringify(e.detail), "color: navy");
}, false);
window.addEventListener("hello7LayerUpdate", function (e) {
console.log("hello7LayerUpdate\n%c" + JSON.stringify(e.detail), "color: green");
checkForLyon();
}, false);
window.addEventListener("hello7PropertyInit", function (e) {
console.log("hello7PropertyInit\n%c" + JSON.stringify(e.detail), "color: navy");
}, false);
window.addEventListener("hello7PropertyUpdate", function (e) {
console.log("hello7PropertyUpdate\n%c" + JSON.stringify(e.detail), "color: green");
}, false);