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

# M

> I membri dell'oggetto principale della libreria.

`M` è un nome breve di [MAIN](../main/). La maggior parte delle applicazioni usa le [funzioni globali](../globals/) al posto di questi membri. Per i concetti alla base, leggi [Path](../../guides/paths/).

## API

### M.binders

Type: `property`

Un array delle associazioni dei dati attive.

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

### M.cl

Type: `property`

Gli elenchi di codici dichiarati, per nome.

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

### M.compile([container])

Type: `method`

Cerca nella pagina nuovi componenti e nuove associazioni.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `container` | `Element|jQuery` | no |  | Limita la ricerca a questo elemento. |

Nel tuo codice usa [COMPILE()](../globals/#compile).

Example: Esempio
```js
console.log(typeof(M.compile)); // function
```

### M.components

Type: `property`

Un array dei componenti creati.

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

### M.days

Type: `property`

Lo stesso array di [DAYS](../globals/#days).

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

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

Type: `method`

Ripristina i valori predefiniti dei componenti su un path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Il path. |
| `delay` | `Number` | no |  | Un ritardo in millisecondi. |
| `component` | `Component` | no |  | Limita la modifica a un solo componente. |
| `reset` | `Boolean` | no | `true` | Con `false`, lo stato viene mantenuto. |

Nel tuo codice usa [DEFAULT()](../globals/#default).

Example: Esempio
```js
console.log(typeof(M.default)); // function
```

### M.defaults

Type: `property`

Lo stesso oggetto di [DEF](../def/).

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

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

Type: `method`

Chiama una funzione per ogni componente.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `fn` | `Function` | yes |  | `function(component, index, wildcard)`. |
| `path` | `String` | no |  | Limita la chiamata a un path. |

Restituisci `true` dalla funzione per interrompere.

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

### M.events

Type: `property`

I gestori di eventi registrati, per nome dell'evento.

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

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

Type: `method`

Unisce i campi a un oggetto.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Il path. |
| `value` | `Object` | yes |  | I campi. |
| `type` | `Number` | no |  | Il tipo di modifica: `1` manuale, `2` input, `3` predefinito. |

Usa [EXT()](../globals/#ext) per una modifica ritardata.

Example: Esempio
```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`

Aggiunge un numero a un valore.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Il path. |
| `value` | `Number` | yes |  | Il numero. |
| `type` | `Number` | no |  | Il tipo di modifica: `1` manuale, `2` input, `3` predefinito. |

Usa [INC()](../globals/#inc) per una modifica ritardata.

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

### M.loaded

Type: `property`

`true` dopo il caricamento delle preferenze memorizzate.

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

### M.macros

Type: `property`

Le macro dichiarate, per nome.

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

### M.months

Type: `property`

Lo stesso array di [MONTHS](../globals/#months).

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

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

Type: `method`

Converte un valore con i parser registrati.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `type` | `String` | yes |  | Il tipo, ad esempio `number`. |
| `value` | `Object` | yes |  | Il valore. |
| `format` | `String` | no |  | Il formato passato ai parser. |

Returns: `Object` Il valore convertito.

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

### M.paths

Type: `property`

Il numero di osservatori e componenti per ogni path.

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

### M.performance

Type: `property`

I contatori di utilizzo, raccolti quando `DEF.monitor` è `true`.

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

### M.plugin([name])

Type: `method`

Legge o modifica lo scope corrente del plugin.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | no |  | Il nuovo scope. |

Returns: `String` Lo scope corrente.

Example: Esempio
```js
M.plugin('users');
console.log(M.plugin()); // users
```

### M.prototypes(fn)

Type: `method`

Dà accesso ai prototipi degli oggetti della libreria.

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

L'oggetto ha i campi `Component`, `Plugin` e `VBinder`.

Example: Esempio
```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`

Aggiunge un valore a un array.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Il path. |
| `value` | `Object` | yes |  | L'elemento. |
| `type` | `Number` | no |  | Il tipo di modifica: `1` manuale, `2` input, `3` predefinito. |

Usa [PUSH()](../globals/#push) per una modifica ritardata.

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

### M.scope([name])

Type: `method`

La stessa funzione di [M.plugin()](#plugin).

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | no |  | Il nuovo scope. |

Returns: `String` Lo scope corrente.

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

### M.scrollbars

Type: `property`

Un array delle barre di scorrimento personalizzate.

Example: Esempio
```js
console.log(M.scrollbars.length); // 0
```

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

Type: `method`

Scrive un valore in un path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Il path. |
| `value` | `Object` | yes |  | Il valore. |
| `type` | `Number` | no |  | Il tipo di modifica: `1` manuale, `2` input, `3` predefinito. |

Usa [SET()](../globals/#set) per una modifica ritardata.

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

### M.ua

Type: `property`

Lo user agent analizzato, con i campi `os`, `browser` e `device`.

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

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

Type: `method`

Aggiorna tutto ciò che è associato a un path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | Il path. |
| `reset` | `Boolean` | no |  | Reimposta lo stato dei componenti. |
| `type` | `Number` | no |  | Il tipo di modifica: `1` manuale, `2` input, `3` predefinito. |

Usa [UPD()](../globals/#upd) per una modifica ritardata.

Example: Esempio
```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`

La versione della libreria.

Example: Esempio
```js
console.log(M.version); // 19.194
```
