---
title: Component
project: jComponent V19
version: 19.194
section: reference
language: sk
license: MIT
url: https://totaljs.es/docs/sk/jcomponent-v19/19-194/reference/component/
updated: 2026-11-18T13:58:29.465Z
---

# Component

> Delegate, vlastnosti a metódy inštancie komponentu.

Inštancia komponentu je objekt odovzdaný deklarácii `COMPONENT()`. Prepája element s path dátového modelu. Ako ju napísať, vysvetľuje časť [Vytváranie komponentov](../../guides/creating-components/) a element popisuje časť [ui-component](../ui-component/). V príkladoch je `com` inštancia nájdená pomocou `FIND()`.

## API

### self.make = function()

Type: `delegate`

Zostaví obsah komponentu.

Delegate sa spustí raz, po deklarácii, keď je element v DOM.

Example: Definícia make
```html
<ui-component name="box"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.make = function() {
            self.html('<b>Ready</b>');
        };
    });
</script>
```

### self.init = function()

Type: `delegate`

Spustí sa raz pre všetky inštancie komponentu.

Tento delegate volá iba prvá inštancia na stránke.

Example: Definícia init
```html
<ui-component name="box"></ui-component>
<ui-component name="box"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.init = () => console.log('once');  // once
    });
</script>
```

### self.done = function()

Type: `delegate`

Spustí sa po inicializácii inštancie.

Delegate sa spustí po prvých volaniach `setter` a `state`.

Example: Definícia done
```html
<ui-component name="box"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.done = () => console.log('done');  // done
    });
</script>
```

### self.released = function(hidden)

Type: `delegate`

Určuje, či je element pri štarte inštancie skrytý.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `hidden` | `Boolean` | yes |  | `true`, keď je element skrytý. |

Delegate sa spustí raz a pre skrytý element dostane `true`.

Example: Definícia released
```html
<ui-component name="box"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.released = hidden => console.log(hidden);  // false
    });
</script>
```

### self.configure = function(key, value, init, prev)

Type: `delegate`

Dostáva konfiguračné kľúče.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `key` | `String` | yes |  | Názov kľúča. |
| `value` | `Object` | yes |  | Nová hodnota. |
| `init` | `Boolean` | yes |  | `true` počas inicializácie. |
| `prev` | `Object` | yes |  | Predchádzajúca hodnota. |

Delegate sa spustí pre každý kľúč počas inicializácie s `init` nastaveným na `true` a znova pre každý zmenený kľúč. Dostáva aj zmeny kľúčov `modified`, `touched` a `invalid`.

Example: Definícia configure
```html
<ui-component name="box" config="title:Orders"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.configure = function(key, value, init, prev) {
            key === 'title' && console.log(value, init);  // Orders true
        };
    });
</script>
```

### self.setter = function(value, path, type)

Type: `delegate`

Dostáva hodnotu na path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Object` | yes |  | Hodnota na path. |
| `path` | `String` | yes |  | Path, ktorý sa zmenil. |
| `type` | `Number` | yes |  | Zdroj zmeny. |

Definuj ho, ak chceš hodnotu vykresliť. Predvolená implementácia zapíše naformátovanú hodnotu do vnorených polí `input`, `select` a `textarea` s atribútom `data-jc-bind`.

Argument `type` hovorí, odkiaľ zmena pochádza:

| Typ | Zdroj |
| --- | --- |
| `0` | Inicializácia. |
| `1` | Manuálna zmena, napríklad `SET()`. |
| `2` | Vstup používateľa. |
| `3` | Predvolená hodnota alebo reset. |

Example: Definícia setter
```html
<ui-component name="box" path="form.name"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.setter = function(value, path, type) {
            self.text(value);
        };
    });
    SET('form.name', 'Peter');
</script>
```

### self.getter(value, [realtime], [nobind])

Type: `delegate`

Zapíše hodnotu od používateľa na path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Object` | yes |  | Nespracovaná hodnota. |
| `realtime` | `Boolean` | no |  | `true`, keď hodnota prichádza počas písania používateľa. |
| `nobind` | `Boolean` | no |  | `true` overí hodnotu bez jej zápisu. |

Predvolená implementácia spustí parsery a zapíše výsledok. Vnorené polia s atribútom `data-jc-bind` ho volajú automaticky. Ak chceš zapísať hodnotu z vlastných ovládacích prvkov, zavolaj ho z nich.

Example: Definícia getter
```html
<ui-component name="box" path="form.name"><button>Set</button></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.make = function() {
            self.event('click', 'button', () => self.getter('Peter'));
        };
    });
    setTimeout(function() {
        $('button').click();
        console.log(GET('form.name'));  // Peter
    }, 500);
</script>
```

### self.setter2 = function(value, path, type)

Type: `delegate`

Spustí sa po delegate `setter`.

Dostáva rovnaké argumenty. Použi ho, keď chceš rozšíriť komponent a zachovať jeho setter.

Example: Definícia setter2
```html
<ui-component name="box" path="form.name"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.setter2 = value => value && console.log(value);  // Peter
    });
    SET('form.name', 'Peter');
</script>
```

### self.getter2 = function(value, realtime)

Type: `delegate`

Spustí sa, keď `getter` dostane hodnotu.

Dostáva spracovanú hodnotu a argument `realtime`.

Example: Definícia getter2
```html
<ui-component name="box" path="form.name"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.getter2 = value => console.log(value);  // PETER
        self.parser((path, value) => value.toUpperCase());
    });
    setTimeout(() => FIND('box').getter('peter'), 500);
</script>
```

### self.state = function(type, what)

Type: `delegate`

Spustí sa pri zmene stavu inštancie.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `type` | `Number` | yes |  | Zdroj zmeny. |
| `what` | `Number` | yes |  | Druh zmeny. |

Argument `type` je `0` pri inicializácii, `1` pri manuálnej zmene a `2` pri vstupe používateľa.

Argument `what` hovorí, čo sa stalo:

| Čo | Význam |
| --- | --- |
| `1` | Validácia. |
| `2` | Zmenil sa stav dotknutia. |
| `3` | Reset. |
| `4` | Aktualizácia. |
| `5` | Nová hodnota. |
| `6` | Upozornenie. |

Example: Definícia state
```html
<ui-component name="box" path="form.name"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.state = function(type, what) {
            console.log(type, what);  // 0 3
        };
    });
</script>
```

### self.state2 = function(type, what)

Type: `delegate`

Spustí sa po delegate `state`.

Dostáva rovnaké argumenty.

Example: Definícia state2
```html
<ui-component name="box" path="form.name"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.state2 = (type, what) => console.log(type, what);  // 0 3
    });
</script>
```

### self.validate = function(value, init)

Type: `delegate`

Rozhodne, či je hodnota platná.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Object` | yes |  | Hodnota na path. |
| `init` | `Boolean` | no |  | `true` počas inicializácie. |

Pre platnú hodnotu vráť `true`. Výsledok sa uloží do `config.invalid`.

Example: Definícia validate
```html
<ui-component name="box" path="form.name"></ui-component>

<script>
    COMPONENT('box', function(self, config) {
        self.validate = value => !!value;
        self.done = () => console.log(config.invalid);  // true
    });
</script>
```

### self.service = function(counter)

Type: `delegate`

Spúšťa sa raz za minútu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `counter` | `Number` | yes |  | Počet spustení. |

Delegate dostáva počítadlo, ktoré sa pri každom spustení zvýši o jednotku.

### self.destroy = function()

Type: `delegate`

Spustí sa pri odstránení inštancie.

Tu uvoľni časovače a externých poslucháčov.

Example: Definícia destroy
```html
<ui-component name="box"></ui-component>

<script>
    COMPONENT('box', function(self) {
        self.destroy = () => console.log('destroyed');  // destroyed
    });
    setTimeout(() => FIND('box').remove(), 500);
</script>
```

### self.name

Type: `property`

Názov komponentu s jeho verziou.

Example: Čítanie name
```html
<ui-component name="box@2"></ui-component>
<script>
    COMPONENT('box@2', self => console.log(self.name));  // box@2
</script>
```

### self.version

Type: `property`

Verzia z názvu komponentu.

Ak názov nemá verziu, hodnota je prázdna. Element tiež dostane triedu `jc-v{version}`.

Example: Čítanie version
```html
<ui-component name="box@2"></ui-component>
<script>
    COMPONENT('box@2', self => console.log(self.version));  // 2
</script>
```

### self.id

Type: `property`

Identifikátor inštancie.

Nastavuje ho konfiguračný kľúč [`$id`](../ui-component/#x-id). Inak má rovnakú hodnotu ako `ID`.

Example: Čítanie id
```html
<ui-component name="box" config="$id:orders"></ui-component>
<script>
    COMPONENT('box', self => self.make = () => console.log(self.id));  // orders
</script>
```

### self.ID

Type: `property`

Jedinečný vygenerovaný identifikátor inštancie.

Example: Čítanie ID
```html
<ui-component name="box"></ui-component>
<script>
    COMPONENT('box', self => console.log(self.ID.substring(0, 2)));  // jc
</script>
```

### self.path

Type: `property`

Path dátového modelu naviazaná na inštanciu.

Ak komponent nemá path, hodnota je prázdna.

Example: Čítanie path
```html
<ui-component name="box" path="form.name"></ui-component>
<script>
    COMPONENT('box', self => console.log(self.path));  // form.name
</script>
```

### self.type

Type: `property`

Dátový typ inštancie.

Hodnota sa odovzdáva parserom a formátovačom. Nastav ju v deklarácii alebo kľúčom [`$type`](../ui-component/#x-type).

Example: Čítanie type
```html
<ui-component name="box"></ui-component>
<script>
    COMPONENT('box', function(self) {
        self.type = 'number';
        self.parser((path, value, type) => console.log(type));  // number
        self.make = () => self.parser('1');
    });
</script>
```

### self.format

Type: `property`

Formát odovzdávaný parserom a formátovačom.

Keď je vlastnosť prázdna, použije sa `config.format`.

Example: Čítanie format
```html
<ui-component name="box"></ui-component>
<script>
    COMPONENT('box', function(self) {
        self.format = 'dd.MM.yyyy';
        self.formatter((path, value, type, format) => console.log(format));  // dd.MM.yyyy
        self.make = () => self.formatter('1');
    });
</script>
```

### self.trim

Type: `property`

V parseri odstráni medzery okolo textu.

Predvolená hodnota je `true`.

Example: Čítanie trim
```html
<ui-component name="box" path="form.name"></ui-component>
<script>
    COMPONENT('box', function(self) {
        self.trim = false;
        self.make = () => console.log(self.parser('  A  ').length);  // 5
    });
</script>
```

### self.config

Type: `property`

Konfiguračný objekt.

Obsahuje aj stavové kľúče `modified`, `touched`, `invalid` a, ak je nastavený, `disabled`.

Example: Čítanie config
```html
<ui-component name="box" config="title:Orders"></ui-component>
<script>
    COMPONENT('box', self => console.log(self.config.title, self.config.touched));  // Orders false
</script>
```

### self.element

Type: `property`

Element inštancie ako objekt jQuery.

Example: Čítanie element
```html
<ui-component name="box"></ui-component>
<script>
    COMPONENT('box', self => console.log(self.element.prop('tagName')));  // UI-COMPONENT
</script>
```

### self.dom

Type: `property`

Element inštancie ako uzol DOM.

Example: Čítanie dom
```html
<ui-component name="box"></ui-component>
<script>
    COMPONENT('box', self => console.log(self.dom.tagName));  // UI-COMPONENT
</script>
```

### self.owner

Type: `property`

Najbližší nadradený komponent.

Ak komponent nemá nadradený komponent, vlastnosť chýba.

Example: Čítanie owner
```html
<ui-component name="parent"><ui-component name="child"></ui-component></ui-component>
<script>
    COMPONENT('parent', function(self) {});
    COMPONENT('child', self => console.log(self.owner.name));  // parent
</script>
```

### self.caller

Type: `property`

Komponent, ktorý zavolal túto inštanciu cez `exec()`.

Example: Čítanie caller
```html
<ui-component name="parent"><ui-component name="child"></ui-component></ui-component>
<script>
    COMPONENT('parent', function(self) {});
    COMPONENT('child', function(self) {
        self.ping = () => console.log(self.caller.name);  // parent
    });
    setTimeout(() => FIND('parent').exec('ping'), 500);
</script>
```

### self.global

Type: `property`

Objekt zdieľaný všetkými inštanciami komponentu.

Example: Čítanie global
```html
<ui-component name="box"></ui-component>
<ui-component name="box"></ui-component>
<script>
    COMPONENT('box', function(self) {
        self.global.count = (self.global.count || 0) + 1;
    });
    setTimeout(() => console.log(FIND('box').global.count), 500);  // 2
</script>
```

### self.scope

Type: `property`

[Scope](../scope/) inštancie.

Vlastnosť existuje, keď path obsahuje `?`.

Example: Čítanie scope
```html
<ui-plugin path="users"><ui-component name="box" path="?.name"></ui-component></ui-plugin>
<script>
    PLUGIN('users', function(exports) {});
    COMPONENT('box', self => console.log(self.scope.path));  // users
</script>
```

### self.pathscope

Type: `property`

Path scopu inštancie.

Vlastnosť existuje, keď path obsahuje `?`.

Example: Čítanie pathscope
```html
<ui-plugin path="users"><ui-component name="box" path="?.name"></ui-component></ui-plugin>
<script>
    PLUGIN('users', function(exports) {});
    COMPONENT('box', self => console.log(self.pathscope));  // users
</script>
```

### self.plugin

Type: `property`

[Plugin](../plugin/) scopu inštancie.

Vlastnosť existuje, keď path obsahuje `?`.

Example: Čítanie plugin
```html
<ui-plugin path="users"><ui-component name="box" path="?.name"></ui-component></ui-plugin>
<script>
    PLUGIN('users', function(exports) {});
    COMPONENT('box', self => console.log(self.plugin.name));  // users
</script>
```

### self.siblings

Type: `property`

Určuje, či element hostí viacero komponentov.

Example: Čítanie siblings
```html
<ui-component name="a,b"></ui-component>
<script>
    COMPONENT('a', self => console.log(self.siblings));  // true
    COMPONENT('b', function(self) {});
</script>
```

### self.removed

Type: `property`

Určuje, či bola inštancia odstránená.

Example: Čítanie removed
```html
<ui-component name="box"></ui-component>
<script>
    COMPONENT('box', function(self) {});
    setTimeout(function() {
        var com = FIND('box');
        com.remove();
        console.log(com.removed);  // true
    }, 500);
</script>
```

### com.get([path])

Type: `method`

Vráti hodnotu na naviazanej path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | no |  | Iná path. |

Returns: `Object` Hodnota.

S argumentom metóda prečíta inú path.

Example: Použitie get()
```js
var com = FIND('demo');
SET('form.name', 'Peter');
console.log(com.get());  // Peter
```

### com.set(value, [type])

Type: `method`

Zapíše hodnotu na naviazanú path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Object` | yes |  | Nová hodnota. |
| `type` | `Number` | no |  | Typ odovzdaný setteru. |

Returns: `Component` Inštancia.

Inštancia sa označí ako upravená.

Example: Použitie set()
```js
var com = FIND('demo');
com.set('Peter');
console.log(GET('form.name'), com.config.modified);  // Peter true
```

### com.modify(value, [type])

Type: `method`

Zapíše hodnotu cez parsery.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Object` | yes |  | Nespracovaná hodnota. |
| `type` | `Number` | no | `2` | Typ odovzdaný setteru. |

Returns: `Component` Inštancia.

Inštancia sa označí ako dotknutá.

Example: Použitie modify()
```js
var com = FIND('demo');
com.modify('  Peter  ');
console.log(GET('form.name'), com.config.touched);  // Peter true
```

### com.inc(value, [type])

Type: `method`

Zvýši číslo uložené na naviazanej path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Number` | yes |  | Prírastok. |
| `type` | `Number` | no |  | Typ odovzdaný setteru. |

Returns: `Component` Inštancia.

Example: Použitie inc()
```js
var com = FIND('demo');
com.set(5);
com.inc(2);
console.log(GET('form.name'));  // 7
```

### com.extend(value, [type])

Type: `method`

Zlúči objekt do naviazanej path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Object` | yes |  | Polia na zlúčenie. |
| `type` | `Number` | no |  | Typ odovzdaný setteru. |

Returns: `Component` Inštancia.

Example: Použitie extend()
```js
var com = FIND('demo');
com.set({ a: 1 });
com.extend({ b: 2 });
console.log(GET('form.name'));  // {"a":1,"b":2}
```

### com.push(value, [type])

Type: `method`

Pridá položku do poľa uloženého na naviazanej path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Object` | yes |  | Položka. |
| `type` | `Number` | no |  | Typ odovzdaný setteru. |

Returns: `Component` Inštancia.

Example: Použitie push()
```js
var com = FIND('demo');
com.push('A');
com.push('B');
console.log(GET('form.name'));  // ["A","B"]
```

### com.rewrite(value, [type])

Type: `method`

Zapíše hodnotu bez upozornenia kohokoľvek.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Object` | yes |  | Nová hodnota. |
| `type` | `Number` | no |  | Typ zmeny. |

Returns: `Component` Inštancia.

Naviazané komponenty, bindery a sledovače sa nezavolajú.

Example: Použitie rewrite()
```js
var com = FIND('demo');
com.rewrite('Peter');
console.log(GET('form.name'));  // Peter
```

### com.update([type])

Type: `method`

Znova zapíše aktuálnu hodnotu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `type` | `Number` | no |  | Typ odovzdaný setteru. |

Returns: `Component` Inštancia.

Upozornia sa všetci poslucháči path.

Example: Použitie update()
```js
var com = FIND('demo');
com.watch(function(path, value) {
    console.log(value);  // Peter
});
window.form.name = 'Peter';
com.update();
```

### com.refresh([notify], [type])

Type: `method`

Zavolá setter tejto inštancie s aktuálnou hodnotou.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `notify` | `Boolean` | no |  | `true` upozorní všetkých poslucháčov. |
| `type` | `Number|String` | no |  | Typ odovzdaný setteru. |

Returns: `Component` Inštancia.

S `notify` sa hodnota zapíše na path a upozornia sa všetci poslucháči.

Example: Použitie refresh()
```js
var com = FIND('demo');
window.form.name = 'Peter';
com.refresh();
console.log(com.text());  // Peter
```

### com.notify()

Type: `method`

Upozorní poslucháčov presne naviazanej path.

Returns: `Component` Inštancia.

Metóda zavolá `NOTIFY()` s path inštancie.

Example: Použitie notify()
```js
var com = FIND('demo');
window.form.name = 'Peter';
com.notify();
console.log(com.text());  // Peter
```

### com.skip()

Type: `method`

Preskočí nasledujúce volanie setteru.

Returns: `Component` Inštancia.

Example: Použitie skip()
```js
var com = FIND('demo');
com.skip();
com.set('Peter');
setTimeout(() => console.log(com.text() || 'empty'), 500);  // empty
```

### com.bind(flags, [value])

Type: `method`

Zmení stav a voliteľne zapíše hodnotu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `flags` | `String` | yes |  | Flagy. |
| `value` | `Object` | no |  | Hodnota na zápis. |

Argument `flags` je zoznam slov oddelených medzerou, čiarkou alebo `|`. Voliteľná predpona `@` sa ignoruje.

| Flag | Účinok |
| --- | --- |
| `touched`, `touch` | Označí inštanciu ako dotknutú. |
| `modified`, `modify`, `changed`, `change` | Označí inštanciu ako upravenú. |
| `reset` | Vymaže stav dotknutia a úpravy. |
| `validate` | Overí hodnotu. |
| `setter` | Zavolá setter. |

Keď odovzdáš `value`, zapíše sa na path a setter tejto inštancie sa spustí iba s flagom `setter`.

Example: Použitie bind()
```js
var com = FIND('demo');
com.bind('@touched @modified', 'Peter');
console.log(GET('form.name'), com.config.touched, com.config.modified);  // Peter true true
```

### com.reset()

Type: `method`

Vymaže stav dotknutia a úpravy.

Returns: `Component` Inštancia.

Hodnota sa znova overí.

Example: Použitie reset()
```js
var com = FIND('demo');
com.modify('Peter');
com.reset();
console.log(com.config.touched, com.config.modified);  // false false
```

### com.default([reset])

Type: `method`

Obnoví predvolenú hodnotu inštancie.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `reset` | `Boolean` | no | `true` | `false` zachová stav inštancie. |

Returns: `Component` Inštancia.

Predvolená hodnota pochádza z atribútu [`default`](../ui-component/#default).

Example: Použitie default()
```js
var com = FIND('demo');
com.set('Peter');
com.default();
console.log(GET('form.name'));  // Anonymous
```

### com.change([value])

Type: `method`

Nastaví stav dotknutia a úpravy komponentov na path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Boolean` | no | `true` | Nový stav. |

Returns: `Component` Inštancia.

Metóda sa vzťahuje na všetky komponenty naviazané na path a na jej vnorené path. Metóda je dostupná aj ako `touched()`.

Example: Použitie change()
```js
var com = FIND('demo');
com.change();
console.log(com.config.touched, com.config.modified);  // true true
```

### com.dirty([value], [noemit])

Type: `method`

Prečíta alebo nastaví stav nedotknutia.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Boolean` | no |  | `false` označí inštanciu ako dotknutú. |
| `noemit` | `Boolean` | no |  | `true` preskočí delegate `state`. |

Returns: `Boolean|Component` Stav, alebo inštancia, keď odovzdáš `value`.

Bez argumentov metóda vráti `true` pre nedotknutú inštanciu.

Example: Použitie dirty()
```js
var com = FIND('demo');
console.log(com.dirty());  // true
com.dirty(false);
console.log(com.config.touched);  // true
```

### com.isInvalid()

Type: `method`

Určuje, či je inštancia dotknutá a neplatná.

Returns: `Boolean` Výsledok.

Example: Použitie isInvalid()
```js
var com = FIND('demo');
com.validate = value => !!value;
com.modify('');
com.validate2();
com.bind('touched');
console.log(com.isInvalid());  // true
```

### com.validate2()

Type: `method`

Spustí delegate `validate` a aktualizuje stav.

Returns: `Boolean` `true` pre platnú hodnotu.

Example: Použitie validate2()
```js
var com = FIND('demo');
com.validate = value => !!value;
console.log(com.validate2());  // false
```

### com.notmodified([fields])

Type: `method`

Určuje, či je hodnota rovnaká ako pri poslednej kontrole.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `fields` | `String|Array` | no |  | Polia na porovnanie. |

Returns: `Boolean` `true`, keď sa hodnota nezmenila.

Prvá kontrola vráti `false`.

Example: Použitie notmodified()
```js
var com = FIND('demo');
com.set('Peter');
console.log(com.notmodified());  // false
console.log(com.notmodified());  // true
```

### com.parser(value, [prepend])

Type: `method`

Pridá parser alebo spracuje hodnotu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Function|Object` | yes |  | Parser alebo hodnota na spracovanie. |
| `prepend` | `Boolean` | no |  | `true` pridá parser na začiatok. |

Returns: `Object` Spracovaná hodnota, alebo inštancia, keď sa pridáva parser.

Funkcia sa pridá medzi parsery inštancie. Dostane `path`, `value`, `type` a `format` a vráti novú hodnotu. Akýkoľvek iný argument sa spracuje a vráti.

Example: Použitie parser()
```js
var com = FIND('demo');
com.parser((path, value) => value.toUpperCase());
console.log(com.parser('peter'));  // PETER
```

### com.formatter(value, [prepend])

Type: `method`

Pridá formátovač alebo naformátuje hodnotu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `Function|Object` | yes |  | Formátovač alebo hodnota na naformátovanie. |
| `prepend` | `Boolean` | no |  | `true` pridá formátovač na začiatok. |

Returns: `Object` Naformátovaná hodnota, alebo inštancia, keď sa pridáva formátovač.

Funkcia sa pridá medzi formátovače inštancie. Dostane `path`, `value`, `type` a `format` a vráti novú hodnotu. Akýkoľvek iný argument sa naformátuje a vráti.

Example: Použitie formatter()
```js
var com = FIND('demo');
com.formatter((path, value) => value + '!');
console.log(com.formatter('Peter'));  // Peter!
```

### com.parsesource(value)

Type: `method`

Prevedie textový zoznam na pole položiek.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `String` | yes |  | Zoznam. |

Returns: `Array` Objekty s `id`, `name` a `icon`.

Položky sú oddelené čiarkou. Každá položka má tvar `id|name|icon`. Keď má inštancia typ `number`, identifikátory sa prevedú na čísla.

Example: Použitie parsesource()
```js
var com = FIND('demo');
console.log(com.parsesource('1|One,2|Two|home')[1]);  // {"id":"2","name":"Two","icon":"home"}
```

### com.reconfigure(value, [callback], [init], [noemit])

Type: `method`

Zmení konfiguráciu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `String|Object` | yes |  | Konfigurácia. |
| `callback` | `Function` | no |  | Dostane `key`, `value`, `init` a `prev` namiesto delegate `configure`. |
| `init` | `Boolean` | no |  | Argument `init` delegate. |
| `noemit` | `Boolean` | no |  | `true` preskočí delegate. |

Returns: `Component` Inštancia.

Hodnota môže byť reťazec dvojíc `key:value`, objekt alebo `=path` na načítanie objektu z path. Delegate `configure` dostane každý kľúč.

Example: Použitie reconfigure()
```js
var com = FIND('demo');
com.reconfigure('title:Orders;limit:10');
console.log(com.config.title, com.config.limit);  // Orders 10
```

### com.configdisplay(key, value)

Type: `method`

Vyhodnotí hodnotu, ktorá závisí od displeja.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `key` | `String` | yes |  | Názov kľúča. |
| `value` | `Object` | yes |  | Hodnota. |

Returns: `Object` Vyhodnotená hodnota.

Hodnota má tvar `@xs=1,@md=2`. Ostatné hodnoty sa vrátia bez zmeny. Pozri [Responzívna konfigurácia](../ui-component/#responsive-configuration).

Example: Použitie configdisplay()
```js
var com = FIND('demo');
console.log(com.configdisplay('size', '@xs=1,@lg=4'), WIDTH());  // 1 xs
```

### com.data(key, [value])

Type: `method`

Prečíta alebo zapíše údaje inštancie.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `key` | `String` | yes |  | Názov kľúča. |
| `value` | `Object` | no |  | Hodnota na zápis. |

Returns: `Object` Hodnota.

Vnorené elementy čítajú kľúče pomocou path `@key`. Prázdny kľúč je aktuálna hodnota inštancie.

Example: Použitie data()
```js
var com = FIND('demo');
com.data('title', 'Orders');
console.log(com.data('title'));  // Orders
```

### com.datasource(path, callback, [init])

Type: `method`

Sleduje path, na ktorej je zdroj údajov.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path zdroja údajov. |
| `callback` | `Function` | yes |  | Funkcia, ktorá dostáva údaje. |
| `init` | `Boolean` | no | `true` | `false` preskočí úvodné volanie. |

Returns: `Component` Inštancia.

Callback dostane `path`, `value` a `type`. Ak `init` nie je `false`, spustí sa aj po načítaní konfigurácie. Nové volanie nahradí predchádzajúci zdroj údajov.

Example: Použitie datasource()
```js
var com = FIND('demo');
com.datasource('common.items', function(path, value) {
    console.log(value);  // [1,2]
}, false);
SET('common.items', [1, 2]);
```

### com.watch([path], callback, [init])

Type: `method`

Sleduje path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | no |  | Path, ktorý sa má sledovať. |
| `callback` | `Function` | yes |  | Funkcia, ktorá dostáva zmeny. |
| `init` | `Boolean` | no |  | `true` zavolá callback okamžite. |

Returns: `Component` Inštancia.

Callback dostane `path`, `value` a `type` a `this` je inštancia. Bez path metóda sleduje path inštancie. Sledovač sa odstráni spolu s inštanciou.

Example: Použitie watch()
```js
var com = FIND('demo');
com.watch('form.age', function(path, value) {
    console.log(path, value);  // form.age 30
});
SET('form.age', 30);
```

### com.unwatch(path)

Type: `method`

Odstráni sledovače path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Sledovaný path. |

Returns: `Component` Inštancia.

Metóda odstráni všetky sledovače, ktoré má táto inštancia na danej path.

Example: Použitie unwatch()
```js
var com = FIND('demo');
com.watch('form.age', () => console.log('called'));
com.unwatch('form.age');
SET('form.age', 30);
console.log('end');  // end
```

### com.on(name, callback)

Type: `method`

Počúva globálnu udalosť.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov udalosti. |
| `callback` | `Function` | yes |  | Poslucháč. |

Returns: `Component` Inštancia.

Poslucháč sa odstráni spolu s inštanciou. Predpona `^` v názve zaradí poslucháča na prvé miesto.

Example: Použitie on()
```js
var com = FIND('demo');
com.on('saved', value => console.log(value));  // 5
EMIT('saved', 5);
```

### com.off(name, [callback])

Type: `method`

Odstráni poslucháča globálnej udalosti.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov udalosti. |
| `callback` | `Function` | no |  | Poslucháč. |

Returns: `Component` Inštancia.

Bez callbacku sa odstránia všetci poslucháči udalosti v tejto inštancii.

Example: Použitie off()
```js
var com = FIND('demo');
var fn = () => console.log('called');
com.on('saved', fn);
com.off('saved', fn);
console.log(EMIT('saved'));  // false
```

### com.emit(name, [...args])

Type: `method`

Vyšle globálnu udalosť.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov udalosti. |
| `args` | `Object` | no |  | Argumenty udalosti. |

Returns: `Component` Inštancia.

Metóda volá `EMIT()`.

Example: Použitie emit()
```js
var com = FIND('demo');
ON('saved', value => console.log(value));  // 5
com.emit('saved', 5);
```

### com.command(name, callback)

Type: `method`

Zaregistruje príkaz inštancie.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov príkazu. |
| `callback` | `Function` | yes |  | Obslužná funkcia. |

Returns: `Component` Inštancia.

Predpona `^` v názve zaradí obslužnú funkciu na prvé miesto. Príkazy volá [`CMD()`](#cmd) alebo globálna funkcia `CMD()`.

Example: Použitie command()
```js
var com = FIND('demo');
com.command('clear', () => console.log('cleared'));  // cleared
CMD('clear');
```

### com.CMD(name, [a], [b], [c], [d], [e])

Type: `method`

Zavolá príkaz tejto inštancie.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov príkazu. |

Returns: `Component` Inštancia.

Metóda prijíma najviac päť argumentov.

Example: Použitie CMD()
```js
var com = FIND('demo');
com.command('add', (a, b) => console.log(a + b));  // 3
com.CMD('add', 1, 2);
```

### com.exec(name, [a], [b], [c], [d], [e])

Type: `method`

Zavolá metódu všetkých vnorených komponentov.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov metódy. |

Returns: `Component` Inštancia.

Každý vnorený komponent dostane túto inštanciu v `caller`.

Example: Použitie exec()
```js
var com = FIND('demo');
com.exec('ping', 5);
```

### com.GET(path)

Type: `method`

Prečíta path relatívnu k scopu inštancie.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |

Returns: `Object` Hodnota.

Znak `?` sa nahradí za path scopu.

Example: Použitie GET()
```js
var com = FIND('demo');
SET('users.name', 'Peter');
console.log(com.GET('?.name'));  // Peter
```

### com.SET(path, value)

Type: `method`

Zapíše na path relatívnu k scopu inštancie.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |
| `value` | `Object` | yes |  | Hodnota. |

Znak `?` sa nahradí za path scopu.

Example: Použitie SET()
```js
var com = FIND('demo');
com.SET('?.age', 30);
console.log(GET('users.age'));  // 30
```

### com.EXEC(path, [a], [b], [c], [d])

Type: `method`

Zavolá funkciu podľa jej path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path funkcie. |

Returns: `Component` Inštancia.

Znak `?` sa nahradí za path scopu. Path s predponou `@` zavolá metódu nadradeného komponentu.

Example: Použitie EXEC()
```js
var com = FIND('child');
com.EXEC('@ping', 5);
```

### com.SEEX(path, [a], [b], [c], [d])

Type: `method`

Zavolá funkciu alebo zapíše hodnotu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |

Returns: `Component` Inštancia.

Metóda zavolá funkciu na path. Keď na path nie je žiadna funkcia, zapíše sa na ňu prvý argument. Predpona `@` funguje s nadradeným komponentom.

Example: Použitie SEEX()
```js
var com = FIND('child');
com.SEEX('@title', 'Orders');
console.log(FIND('demo').title);  // Orders
```

### com.makepath(path)

Type: `method`

Preloží path v scope inštancie.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |

Returns: `String` Preložená path.

Example: Použitie makepath()
```js
var com = FIND('demo');
console.log(com.makepath('?.age'));  // users.age
```

### com.scopepath(path)

Type: `method`

Nahradí `?` v path za path scopu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |

Returns: `String` Preložená path.

Path bez `?` sa vráti bez zmeny.

Example: Použitie scopepath()
```js
var com = FIND('demo');
console.log(com.scopepath('?.age'), com.scopepath('form.age'));  // users.age form.age
```

### com.setPath(path)

Type: `method`

Zmení naviazanú path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Nový path. |

Returns: `Component` Inštancia.

Example: Použitie setPath()
```js
var com = FIND('demo');
com.setPath('form.other');
SET('form.other', 5);
console.log(com.path, com.get());  // form.other 5
```

### com.blind()

Type: `method`

Odpojí inštanciu od jej path.

Returns: `Component` Inštancia.

Example: Použitie blind()
```js
var com = FIND('demo');
com.blind();
SET('form.name', 'Peter');
console.log(com.path, com.text() || 'empty');  // null empty
```

### self.readonly()

Type: `method`

Odstráni delegate `setter`, `getter` a `validate`.

Returns: `Component` Inštancia.

Použi ju v komponentoch, ktoré iba zobrazujú obsah.

Example: Použitie readonly()
```js
var com = FIND('demo');
console.log(com.setter, com.getter);  // null null
```

### self.singleton()

Type: `method`

Povolí na stránke iba jednu inštanciu komponentu.

Returns: `Component` Inštancia.

Ostatné elementy toho istého komponentu sa odstránia.

Example: Použitie singleton()
```js
console.log(FIND('demo', true).length, $('ui-component').length);  // 1 1
```

### self.bindchanges([enable])

Type: `method`

Preskočí setter, keď sa hodnota nezmenila.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `enable` | `Boolean` | no | `true` | `false` túto funkciu vypne. |

Returns: `Component` Inštancia.

Example: Použitie bindchanges()
```js
SET('form.name', 'A');
SET('form.name', 'A');
setTimeout(() => console.log(window.calls), 500);  // 2
```

### self.bindexact([enable])

Type: `method`

Ignoruje zmeny vnorených path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `enable` | `Boolean` | no | `true` | `false` túto funkciu vypne. |

Returns: `Component` Inštancia.

Setter sa spustí iba pre presnú path alebo jej nadradené path.

Example: Použitie bindexact()
```js
SET('form.user.name', 'Peter');
setTimeout(() => console.log(window.calls), 500);  // 1
```

### self.bindvisible([timeout])

Type: `method`

Odloží setter, kým nebude element viditeľný.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `timeout` | `Number|Boolean` | no | `DEF.delaybinder` | Oneskorenie v milisekundách po tom, ako sa element stane viditeľným. `false` túto funkciu vypne. |

Returns: `Component` Inštancia.

Example: Použitie bindvisible()
```js
SET('form.name', 'Peter');
setTimeout(() => $('#tab').show(), 500);
setTimeout(() => console.log($('ui-component').text()), 1500);  // Peter
```

### self.autofill([enable])

Type: `method`

Prečíta hodnoty vyplnené prehliadačom.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `enable` | `Boolean` | no | `true` | `false` túto funkciu vypne. |

Returns: `Component` Inštancia.

Keď je stránka pripravená, hodnota vnorených polí s atribútom `data-jc-bind` sa zapíše na path.

Example: Použitie autofill()
```js
$('input').val('Peter');
setTimeout(() => console.log(GET('form.name')), 1400);  // Peter
```

### com.caniuse(name)

Type: `method`

Určuje, či je komponent dostupný.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov komponentu. |

Returns: `Number` `1` pre deklarovaný komponent, `2` pre lazy komponent, `undefined` pre neznámy komponent.

Example: Použitie caniuse()
```js
var com = FIND('demo');
console.log(com.caniuse('demo'));  // 1
```

### com.main()

Type: `method`

Vráti najbližší nadradený komponent.

Returns: `Component` Nadradený komponent alebo `null`.

Example: Použitie main()
```js
var com = FIND('child');
console.log(com.main().name);  // demo
```

### com.compile([container])

Type: `method`

Skompiluje nový obsah elementu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `container` | `jQuery|Element` | no | `the component element` | Element, ktorý sa má skompilovať. |

Returns: `Component` Inštancia.

Zavolaj ju po pridaní elementov s väzbami alebo komponentmi.

Example: Použitie compile()
```js
var com = FIND('demo');
com.append('<div data-bind="form.name__text"></div>');
com.compile();
SET('form.name', 'Peter');
setTimeout(() => console.log(com.find('div').text()), 500);  // Peter
```

### com.import(url, [callback], [insert], [preparator])

Type: `method`

Importuje obsah do elementu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `url` | `String` | yes |  | URL. |
| `callback` | `Function` | no |  | Spustí sa po importe. |
| `insert` | `Boolean` | no |  | Argument `insert` funkcie `IMPORT()`. |
| `preparator` | `Function` | no |  | Zmení odpoveď pred vložením. |

Returns: `Component` Inštancia.

Metóda zavolá `IMPORT()` s elementom ako cieľom.

Example: Použitie import()
```js
var com = FIND('demo');
com.import('/part.html', () => console.log('imported'));  // imported
```

### com.replace(element, [remove])

Type: `method`

Presunie inštanciu na iný element.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `element` | `jQuery|Element` | yes |  | Nový element. |
| `remove` | `Boolean` | no |  | `true` odstráni pôvodný element. |

Returns: `Component` Inštancia.

Example: Použitie replace()
```js
var com = FIND('demo');
com.replace($('#target'), true);
console.log(com.dom.id, $('ui-component').length);  // target 0
```

### com.remove([noclear])

Type: `method`

Odstráni inštanciu a jej element.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `noclear` | `Boolean` | no |  | `true` nespustí čistenie okamžite. |

Returns: `Boolean` Vždy `true`.

Počas čistenia sa spustí delegate `destroy`. Metóda je dostupná aj ako `kill()`.

Example: Použitie remove()
```js
var com = FIND('demo');
console.log(com.remove());  // true
```

### com.find(selector)

Type: `method`

Nájde vnorené elementy.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `selector` | `String|Object` | yes |  | Selektor alebo objekt selektorov. |

Returns: `jQuery|Object` Výsledok.

Objekt selektorov vráti objekt výsledkov jQuery s rovnakými kľúčmi.

Example: Použitie find()
```js
var com = FIND('demo');
console.log(com.find('.label').text());  // Text
```

### com.closest(selector)

Type: `method`

Nájde najbližší zodpovedajúci nadradený element.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `selector` | `String` | yes |  | Selektor. |

Returns: `jQuery` Výsledok.

Example: Použitie closest()
```js
var com = FIND('demo');
console.log(com.closest('body').length);  // 1
```

### com.parent([selector])

Type: `method`

Vráti nadradený element.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `selector` | `String` | no |  | Selektor. |

Returns: `jQuery` Výsledok.

Argument môže byť:

| Hodnota | Výsledok |
| --- | --- |
| vynechaný | Priamy nadradený element. |
| Selektor | Najbližší zodpovedajúci element. |
| `auto` | Najbližší nadradený element s definovanou výškou, inak `window`. |
| `window` | `window` ako objekt jQuery. |
| `document` | Objekt `document`. |
| `parent` | Priamy nadradený element. |
| `parent2` | Element o dve úrovne nad priamym nadradeným elementom. |

Example: Použitie parent()
```js
var com = FIND('demo');
console.log(com.parent().prop('tagName'));  // BODY
```

### com.html([value])

Type: `method`

Prečíta alebo nahradí obsah HTML.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `String|Array` | no |  | Nový obsah. |

Returns: `String|jQuery` Obsah, alebo element, keď odovzdáš `value`.

Pole sa spojí.

Example: Použitie html()
```js
var com = FIND('demo');
com.html('<b>A</b>');
console.log(com.html());  // <b>A</b>
```

### com.text([value])

Type: `method`

Prečíta alebo nahradí textový obsah.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `String|Array` | no |  | Nový obsah. |

Returns: `String|jQuery` Obsah, alebo element, keď odovzdáš `value`.

Pole sa spojí.

Example: Použitie text()
```js
var com = FIND('demo');
com.text('<b>A</b>');
console.log(com.html());  // &lt;b&gt;A&lt;/b&gt;
```

### com.append(value)

Type: `method`

Pridá obsah na koniec elementu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `String|Array` | yes |  | Obsah. |

Returns: `jQuery` Element.

Pole sa spojí.

Example: Použitie append()
```js
var com = FIND('demo');
com.empty();
com.append('<b>A</b>');
console.log(com.html());  // <b>A</b>
```

### com.empty()

Type: `method`

Odstráni obsah elementu.

Returns: `jQuery` Element.

Odstránia sa aj vnorené komponenty.

Example: Použitie empty()
```js
var com = FIND('demo');
com.empty();
console.log(com.html() === '');  // true
```

### com.event(name, [selector], callback)

Type: `method`

Pripojí k elementu udalosť jQuery.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov udalosti. |
| `selector` | `String` | no |  | Delegovaný selektor. |
| `callback` | `Function` | yes |  | Obslužná funkcia. |

Returns: `Component` Inštancia.

Argumenty sú rovnaké ako pri metóde jQuery `on()`.

Example: Použitie event()
```js
var com = FIND('demo');
com.event('click', '.label', () => console.log('clicked'));  // clicked
com.find('.label').click();
```

### com.aclass(classes, [timeout])

Type: `method`

Pridá triedy CSS.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `classes` | `String` | yes |  | Triedy. |
| `timeout` | `Number` | no |  | Oneskorenie v milisekundách. |

Returns: `Component` Inštancia.

Example: Použitie aclass()
```js
var com = FIND('demo');
com.aclass('active');
console.log(com.hclass('active'));  // true
```

### com.rclass([classes], [timeout])

Type: `method`

Odstráni triedy CSS.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `classes` | `String` | no |  | Triedy. |
| `timeout` | `Number` | no |  | Oneskorenie v milisekundách. |

Returns: `Component` Inštancia.

Bez argumentu sa odstránia všetky triedy.

Example: Použitie rclass()
```js
var com = FIND('demo');
com.aclass('active');
com.rclass('active');
console.log(com.hclass('active'));  // false
```

### com.rclass2(search)

Type: `method`

Odstráni triedy CSS, ktoré obsahujú zadaný text.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `search` | `String|RegExp` | yes |  | Text alebo regulárny výraz. |

Returns: `Component` Inštancia.

Example: Použitie rclass2()
```js
var com = FIND('demo');
com.aclass('col-1 col-2');
com.rclass2('col-');
console.log(com.hclass('col-1'));  // false
```

### com.tclass(classes, [state])

Type: `method`

Prepne triedy CSS.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `classes` | `String` | yes |  | Triedy. |
| `state` | `Boolean` | no |  | Vynúti stav. |

Returns: `Component` Inštancia.

Example: Použitie tclass()
```js
var com = FIND('demo');
com.tclass('active', true);
console.log(com.hclass('active'));  // true
```

### com.hclass(name)

Type: `method`

Zistí, či má element triedu CSS.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Trieda. |

Returns: `Boolean` Výsledok.

Example: Použitie hclass()
```js
var com = FIND('demo');
console.log(com.hclass('missing'));  // false
```

### com.attr(name, [value])

Type: `method`

Prečíta alebo zapíše atribút.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Atribút. |
| `value` | `String` | no |  | Nová hodnota. |

Returns: `String|Component` Hodnota, alebo inštancia, keď odovzdáš `value`.

Example: Použitie attr()
```js
var com = FIND('demo');
com.attr('title', 'Orders');
console.log(com.attr('title'));  // Orders
```

### com.attrd(name, [value])

Type: `method`

Prečíta alebo zapíše atribút `data-`.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov bez prefixu `data-`. |
| `value` | `String` | no |  | Nová hodnota. |

Returns: `String|Component` Hodnota, alebo inštancia, keď odovzdáš `value`.

Example: Použitie attrd()
```js
var com = FIND('demo');
com.attrd('id', '5');
console.log(com.attr('data-id'));  // 5
```

### com.attrd2(name)

Type: `method`

Prečíta atribút `data-` z elementu alebo z jeho najbližšieho nadradeného elementu, ktorý ho má.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Názov bez prefixu `data-`. |

Returns: `String` Hodnota.

Example: Použitie attrd2()
```js
var com = FIND('demo');
console.log(com.attrd2('group'));  // main
```

### com.css(name, [value])

Type: `method`

Prečíta alebo zapíše vlastnosť CSS.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Vlastnosť. |
| `value` | `String` | no |  | Nová hodnota. |

Returns: `String|Component` Hodnota, alebo inštancia, keď odovzdáš `value`.

Example: Použitie css()
```js
var com = FIND('demo');
com.css('display', 'block');
console.log(com.css('display'));  // block
```

### com.visible([callback])

Type: `method`

Určuje, či je element viditeľný.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `callback` | `Function` | no |  | Spustí sa, keď je element viditeľný. |

Returns: `Boolean` Aktuálna viditeľnosť.

S callbackom sa funkcia spustí, hneď ako je element viditeľný.

Example: Použitie visible()
```js
var com = FIND('demo');
console.log(com.visible());  // true
```

### com.width([callback])

Type: `method`

Vráti šírku elementu v pixeloch.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `callback` | `Function` | no |  | Dostane šírku. |

Returns: `Number` Šírka.

S callbackom sa funkcia spustí, hneď ako je šírka väčšia ako nula.

Example: Použitie width()
```js
var com = FIND('demo');
com.css('display', 'block');
com.css('width', '200px');
console.log(com.width());  // 200
```

### com.height([callback])

Type: `method`

Vráti výšku elementu v pixeloch.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `callback` | `Function` | no |  | Dostane výšku. |

Returns: `Number` Výška.

S callbackom sa funkcia spustí, hneď ako je výška väčšia ako nula.

Example: Použitie height()
```js
var com = FIND('demo');
com.css('display', 'block');
com.css('height', '50px');
console.log(com.height());  // 50
```

### com.autofocus([selector])

Type: `method`

Presunie fokus na prvé viditeľné pole.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `selector` | `String` | no | `input,select,textarea` | Polia. |

Returns: `Component` Inštancia.

Keď žiadne pole nemôže prijať fokus, metóda to krátko skúša znova. Na mobilných zariadeniach nerobí nič.

Example: Použitie autofocus()
```js
var com = FIND('demo');
com.autofocus();
console.log(document.activeElement.tagName);  // INPUT
```

### com.faicon(value)

Type: `method`

Doplní názov ikony.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `String` | yes |  | Názov ikony. |

Returns: `String` Triedy CSS.

Názov bez medzery dostane `DEF.iconprefix`, čo je `ti ti-`. Metóda je dostupná aj ako `icon()`.

Example: Použitie faicon()
```js
var com = FIND('demo');
console.log(com.faicon('home'));  // ti ti-home
```
