j-Watcher
This component executes the code defined in the <script type="text/js"></script> tag.
<script type="text/js">
// value {Object} a value bound according to the path
// path {String} a path where the value was bonded
// type {Number} binding type (0: init, 1: manually, 2: by input, 3: default value)
// element {jQuery element} a current element
// datasource {Object}
// component {jComponent}
</script>Configuration:
delay {Number}a delay for evaluating code (default:0)- NEW:
datasource {String}a link to the datasource (it will be stored indatasourceproperty)
IMPORTANT:
You need to use <script type="text/js"> or <script type="text/plain">. Don't use the script element without type or with type text|application/javascript because the script will be evaluated by the browser automatically.
Use it with <ui-component name="watcher">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.
<ui-component name="watcher" path="common.value">
<script type="text/js">
console.log('-->', value, path, type);
element.html(value);
</script>
</ui-component>
<script>
var common = { value: 'init' };
setInterval(function() {
SET('common.value', new Date().format('HH:mm:ss'));
}, 1000);
</script>