# j-Watcher

> Този компонент изпълнява кода, определен в <script type='text/js'></script> етикет.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: bg
Content-SHA256: 89cf51c93bdcd807e2f7e46512456c053537510a74322c99354ac5d130206d6b
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

Този компонент изпълнява кода, определен в етикета `<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>
```

__Конфигуриране__:

- `delay {Number}` закъснение за оценка на кода (предварително: `0`)
- __NEW__: `datasource {String}` връзка към източника на данни (това ще бъде съхранено в собствеността на `datasource`)

__Важен__:

Трябва да използвате `<script type="text/js">` или `<script type="text/plain">`Не използвайте елемента на сценария без `type` или с тип `text|application/javascript` Защото скриптът ще бъде оценен автоматично от браузъра.

Използвайте го с `<ui-component name="watcher">`Когато компонентът все още не е зареден, jComponent Изтегляне на първия адрес в `DEF.fallback` (След това Componentator Източник: Питър Шерка Componentator Съставни съставки, лиценз на 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>
```
