# j-AutoExec

> This component automatically executes a method defined in exec option.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 81e4f9406413d93e08ef32e832409dc8d8d9545b974786ae1cb01c115213af57
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

This component automatically executes a method defined in `exec` option.


__Configuration__:

- __IMPORTANT__ `exec {String}` a path to the method `function(el, value)`
- `delay {Number}` a delay for evaluating code (default: `0`)
- `init {Boolean}` executes initial value (default: `false`)
- `input {Boolean}` executes value binded by the input (default: `true`)
- `manually {Boolean}` executes value binded manually via e.g. `SET()` method (default: `false`)
- `track {String}` can contain partial paths divided by the comma

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

```html example.html
<ui-component name="autoexec" path="common.value" config="exec:autoexec;manually:1"></ui-component>

<script>

	function autoexec(el, value) {
		console.log('Exec:', value);
		el.html(value);
	}

	var common = {};

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

</script>
```
