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

# M

> Členovia hlavného objektu knižnice.

`M` je krátky názov pre [MAIN](../main/). Väčšina aplikácií namiesto týchto členov používa [globálne funkcie](../globals/). Základné pojmy nájdeš v časti [Paths](../../guides/paths/).

## API

### M.binders

Type: `property`

Pole aktívnych dátových väzieb.

Example: Príklad
```js
SET('name', 'Peter');
setTimeout(function() {
	console.log(M.binders.length); // 1
}, 300);
```

### M.cl

Type: `property`

Deklarované zoznamy kódov podľa názvu.

Example: Príklad
```js
CL_INIT('roles', next => next([]));
console.log(Object.keys(M.cl)); // ["roles"]
```

### M.compile([container])

Type: `method`

Vyhľadá na stránke nové komponenty a väzby.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `container` | `Element|jQuery` | no |  | Obmedzí vyhľadávanie na tento element. |

Vo svojom kóde použi [COMPILE()](../globals/#compile).

Example: Príklad
```js
console.log(typeof(M.compile)); // function
```

### M.components

Type: `property`

Pole vytvorených komponentov.

Example: Príklad
```js
ON('ready', function() {
	console.log(M.components.length); // 2
});
```

### M.days

Type: `property`

To isté pole ako [DAYS](../globals/#days).

Example: Príklad
```js
console.log(M.days === DAYS); // true
```

### M.default(path, [delay], [component], [reset])

Type: `method`

Obnoví predvolené hodnoty komponentov na path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |
| `delay` | `Number` | no |  | Oneskorenie v milisekundách. |
| `component` | `Component` | no |  | Obmedzí zmenu na jeden komponent. |
| `reset` | `Boolean` | no | `true` | S hodnotou `false` sa stav zachová. |

Vo svojom kóde použi [DEFAULT()](../globals/#default).

Example: Príklad
```js
console.log(typeof(M.default)); // function
```

### M.defaults

Type: `property`

Ten istý objekt ako [DEF](../def/).

Example: Príklad
```js
console.log(M.defaults === DEF); // true
```

### M.each(fn, [path])

Type: `method`

Zavolá funkciu pre každý komponent.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `fn` | `Function` | yes |  | `function(component, index, wildcard)`. |
| `path` | `String` | no |  | Obmedzí volanie na path. |

Ak chceš skončiť, vráť z funkcie `true`.

Example: Príklad
```js
ON('ready', function() {
	var paths = [];
	M.each(com => paths.push(com.path), 'form.*');
	console.log(paths.length); // 2
});
```

### M.events

Type: `property`

Zaregistrované obslužné funkcie udalostí podľa názvu udalosti.

Example: Príklad
```js
ON('hello', NOOP);
console.log(M.events.hello.length); // 1
```

### M.extend(path, value, [type])

Type: `method`

Zlúči polia do objektu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |
| `value` | `Object` | yes |  | Polia. |
| `type` | `Number` | no |  | Typ zmeny: `1` ručná, `2` vstup, `3` predvolená. |

Na oneskorenú zmenu použi [EXT()](../globals/#ext).

Example: Príklad
```js
SET('user', { a: 1 });
M.extend('user', { b: 2 });
console.log(GET('user')); // {"a":1,"b":2}
```

### M.inc(path, value, [type])

Type: `method`

Pripočíta číslo k hodnote.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |
| `value` | `Number` | yes |  | Číslo. |
| `type` | `Number` | no |  | Typ zmeny: `1` ručná, `2` vstup, `3` predvolená. |

Na oneskorenú zmenu použi [INC()](../globals/#inc).

Example: Príklad
```js
M.inc('count', 2);
console.log(GET('count')); // 2
```

### M.loaded

Type: `property`

`true` po načítaní uložených preferencií.

Example: Príklad
```js
setTimeout(function() {
	console.log(M.loaded); // true
}, 500);
```

### M.macros

Type: `property`

Deklarované macros podľa názvu.

Example: Príklad
```js
MACRO('upper', NOOP);
console.log(typeof(M.macros.upper)); // function
```

### M.months

Type: `property`

To isté pole ako [MONTHS](../globals/#months).

Example: Príklad
```js
console.log(M.months === MONTHS); // true
```

### M.parse(type, value, [format])

Type: `method`

Prevedie hodnotu pomocou zaregistrovaných parserov.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `type` | `String` | yes |  | Typ, napríklad `number`. |
| `value` | `Object` | yes |  | Hodnota. |
| `format` | `String` | no |  | Formát odovzdaný parserom. |

Returns: `Object` Prevedená hodnota.

Example: Príklad
```js
console.log(M.parse('number', '5')); // 5
```

### M.paths

Type: `property`

Počet sledovačov a komponentov pre každý path.

Example: Príklad
```js
WATCH('user.name', NOOP);
console.log(M.paths['user.name']); // 1
```

### M.performance

Type: `property`

Počítadlá používania, ktoré sa zbierajú, keď má `DEF.monitor` hodnotu `true`.

Example: Príklad
```js
DEF.monitor = true;
GET('a');
console.log(M.performance.get.count > 0); // true
```

### M.plugin([name])

Type: `method`

Prečíta alebo zmení aktuálny scope pluginu.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | no |  | Nový scope. |

Returns: `String` Aktuálny scope.

Example: Príklad
```js
M.plugin('users');
console.log(M.plugin()); // users
```

### M.prototypes(fn)

Type: `method`

Sprístupní prototypy objektov knižnice.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `fn` | `Function` | yes |  | `function(proto)`. |

Objekt má polia `Component`, `Plugin` a `VBinder`.

Example: Príklad
```js
M.prototypes(function(proto) {
	proto.Component.hello = () => 'Hello';
});
ON('ready', function() {
	console.log(FIND('textbox').hello()); // Hello
});
```

### M.push(path, value, [type])

Type: `method`

Pridá hodnotu do poľa.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |
| `value` | `Object` | yes |  | Položka. |
| `type` | `Number` | no |  | Typ zmeny: `1` ručná, `2` vstup, `3` predvolená. |

Na oneskorenú zmenu použi [PUSH()](../globals/#push).

Example: Príklad
```js
M.push('list', 1);
console.log(GET('list')); // [1]
```

### M.scope([name])

Type: `method`

Rovnaká funkcia ako [M.plugin()](#plugin).

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | no |  | Nový scope. |

Returns: `String` Aktuálny scope.

Example: Príklad
```js
console.log(M.scope === M.plugin); // true
```

### M.scrollbars

Type: `property`

Pole vlastných posuvníkov.

Example: Príklad
```js
console.log(M.scrollbars.length); // 0
```

### M.set(path, value, [type])

Type: `method`

Zapíše hodnotu do path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |
| `value` | `Object` | yes |  | Hodnota. |
| `type` | `Number` | no |  | Typ zmeny: `1` ručná, `2` vstup, `3` predvolená. |

Na oneskorenú zmenu použi [SET()](../globals/#set).

Example: Príklad
```js
M.set('name', 'Peter');
console.log(GET('name')); // Peter
```

### M.ua

Type: `property`

Spracovaný user agent s poľami `os`, `browser` a `device`.

Example: Príklad
```js
console.log(Object.keys(M.ua)); // ["os","browser","device"]
```

### M.update(path, [reset], [type])

Type: `method`

Obnoví všetko, čo je naviazané na path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Path. |
| `reset` | `Boolean` | no |  | Vynuluje stav komponentov. |
| `type` | `Number` | no |  | Typ zmeny: `1` ručná, `2` vstup, `3` predvolená. |

Na oneskorenú zmenu použi [UPD()](../globals/#upd).

Example: Príklad
```js
SET('user', { name: 'Peter' });
WATCH('user.name', function(path, value) {
	console.log(value); // Anna
});
GET('user').name = 'Anna';
M.update('user.name');
```

### M.version

Type: `property`

Verzia knižnice.

Example: Príklad
```js
console.log(M.version); // 19.194
```
