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.
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.ImpAutoLoadModules
with object with certain structure:
//autoload
window.ImpAutoLoadModules = {
modules: [
["<helper-name>", "<method to call>" , <parameters>],
// you can skip method,
// "animate" will be called by default
["<helper2-name>",, <parameters object>],
// you can skip method and params,
// only "init" will be called
// ("init" is always called)
["<helper2-name>"]
...
]
};
Restrictions
- If autoloaded helper has to receive parameters, it must use JSON parameter format (not YAML or raw text).