ForgeComponents
en

Components

j-Watch

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

The component can evaluate the method in the form function(value, element, type, path) when the value (according to the path) is changed. The component can simplify watching changes in the model.


Configuration:

  • exec a link to the method function(value, element, flags, path)

Use it with <ui-component name="watch">. 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.

example.html
<ui-component name="watch" path="common.value" config="exec:changedvalue"></ui-component>

<div class="padding">
	<div id="mytitle"></div>
</div>

<script>

	var common = { value: 'init' };

	setInterval(function() {
		SET('common.value', new Date().format('HH:mm:ss'));
	}, 1000);

	function changedvalue(value, element, type, path) {
		$('#mytitle').html(value);
	}

</script>