# j-Watcher

> Este componente ejecuta el código definido en la etiqueta <script type='text/js'></script>.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: es
Content-SHA256: 68386930c2de7b61de6285f418325d076ea72ba3d37857a1c94df1974b5a949a
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

Este componente ejecuta el código definido en la etiqueta `<script type="text/js"></script>`.

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

__Configuración__:

- `delay {Number}` un retraso para evaluar el código (predeterminado: `0`)
- __NUEVO__: `datasource {String}` un enlace a la fuente de datos (se almacenará en la propiedad `datasource`)

__IMPORTANTE__:

Debe utilizar `<script type="text/js">` o `<script type="text/plain">`. No utilice el elemento script sin `type` o con el tipo `text|application/javascript` porque el navegador evaluará el script automáticamente.

Úselo con `<ui-component name="watcher">`. Cuando el componente aún no está cargado, jComponent lo descarga en el primer uso desde la dirección en `DEF.fallback` (el CDN Componentator de forma predeterminada). Autor: Peter Širka. Fuente: repositorio de componentes Componentator, licencia MIT.

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