Autoload helpers (upcoming feature)
What it is
It will possible to autoload and engage helpers on page load, which makes possible to:
- Share the same widget or any other data between many IMP! pages.
- Add interactivity without additional code.
- Postprocess all pages of one set in the unified way
- Automate some editor tasks (in future)
How?
There must be file autoload.js
in the helpers directory, which will be automatically load with IMP! page, if this page has helpers enabled.
autoload.js
The script must define window.impHelpers.autoload
variable with object with certain structure:
//autoload
window.impHelpers.autoload = {
modules: [
["<helper-name>", "<method to call>" , <parameters>],
// you can skip method,
// "autoload" will be called by default,
// or "animate" if "autoload" is not present
["<helper2-name>",<parameters object>],
// you can skip method and params,
// only "init" will be called
// ("init" is always called)
["<helper2-name>"]
...
]
};