ForgeKomponenty
pl

Komponenty

j-Watcher

jComponent 20 · jcomponent@20 component Przykład załadowany z jComponent 20

Ten element wykonuje kod zdefiniowany w tagie <script type="text/js"></script>.

<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>

Konfiguracja:

  • delay {Number} opóźnienie w ocenie kodu (default: 0)
  • NEW: datasource {String} link do źródła danych (będzie przechowywany w właściwościach datasource)

Ważne:

Musisz używać <script type="text/js"> lub <script type="text/plain">Nie używaj elementu scenariusza bez type lub z typem text|application/javascript Ponieważ scenariusz zostanie automatycznie oceniany przez przeglądarkę.

Użyj go z <ui-component name="watcher">Gdy element nie jest jeszcze ładowany, jComponent Pobierz go po pierwszym użyciu z adresu DEF.fallback (Wydaje się Componentator Autor: Peter Širka Źródło: Componentator Zestaw składników, licencja MIT.

example.html
<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>