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

# M

> The members of the main object of the library.

`M` is a short name of [MAIN](../main/). Most applications use the [global functions](../globals/) instead of these members. For the concepts behind them, read [Paths](../../guides/paths/).

## API

### M.binders

Type: `property`

An array of the active data bindings.

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

### M.cl

Type: `property`

The declared code lists by name.

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

### M.compile([container])

Type: `method`

Searches the page for new components and bindings.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `container` | `Element|jQuery` | no |  | Limits the search to this element. |

Use [COMPILE()](../globals/#compile) in your code.

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

### M.components

Type: `property`

An array of the created components.

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

### M.days

Type: `property`

The same array as [DAYS](../globals/#days).

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

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

Type: `method`

Restores the default values of the components on a path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | The path. |
| `delay` | `Number` | no |  | A delay in milliseconds. |
| `component` | `Component` | no |  | Limits the change to one component. |
| `reset` | `Boolean` | no | `true` | With `false`, the state is kept. |

Use [DEFAULT()](../globals/#default) in your code.

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

### M.defaults

Type: `property`

The same object as [DEF](../def/).

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

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

Type: `method`

Calls a function for each component.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `fn` | `Function` | yes |  | `function(component, index, wildcard)`. |
| `path` | `String` | no |  | Limits the call to a path. |

Return `true` from the function to stop.

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

### M.events

Type: `property`

The registered event handlers by event name.

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

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

Type: `method`

Merges fields into an object.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | The path. |
| `value` | `Object` | yes |  | The fields. |
| `type` | `Number` | no |  | The change type: `1` manual, `2` input, `3` default. |

Use [EXT()](../globals/#ext) for a delayed change.

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

Adds a number to a value.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | The path. |
| `value` | `Number` | yes |  | The number. |
| `type` | `Number` | no |  | The change type: `1` manual, `2` input, `3` default. |

Use [INC()](../globals/#inc) for a delayed change.

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

### M.loaded

Type: `property`

`true` after the stored preferences are loaded.

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

### M.macros

Type: `property`

The declared macros by name.

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

### M.months

Type: `property`

The same array as [MONTHS](../globals/#months).

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

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

Type: `method`

Converts a value with the registered parsers.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `type` | `String` | yes |  | The type, for example `number`. |
| `value` | `Object` | yes |  | The value. |
| `format` | `String` | no |  | The format passed to the parsers. |

Returns: `Object` The converted value.

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

### M.paths

Type: `property`

The number of watchers and components for each path.

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

### M.performance

Type: `property`

Usage counters, collected when `DEF.monitor` is `true`.

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

### M.plugin([name])

Type: `method`

Reads or changes the current plugin scope.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | no |  | The new scope. |

Returns: `String` The current scope.

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

### M.prototypes(fn)

Type: `method`

Gives access to the prototypes of the library objects.

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

The object has the fields `Component`, `Plugin` and `VBinder`.

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

Adds a value to an array.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | The path. |
| `value` | `Object` | yes |  | The item. |
| `type` | `Number` | no |  | The change type: `1` manual, `2` input, `3` default. |

Use [PUSH()](../globals/#push) for a delayed change.

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

### M.scope([name])

Type: `method`

The same function as [M.plugin()](#plugin).

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | no |  | The new scope. |

Returns: `String` The current scope.

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

### M.scrollbars

Type: `property`

An array of the custom scrollbars.

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

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

Type: `method`

Writes a value to a path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | The path. |
| `value` | `Object` | yes |  | The value. |
| `type` | `Number` | no |  | The change type: `1` manual, `2` input, `3` default. |

Use [SET()](../globals/#set) for a delayed change.

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

### M.ua

Type: `property`

The parsed user agent with the fields `os`, `browser` and `device`.

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

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

Type: `method`

Refreshes everything bound to a path.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | yes |  | The path. |
| `reset` | `Boolean` | no |  | Resets the state of the components. |
| `type` | `Number` | no |  | The change type: `1` manual, `2` input, `3` default. |

Use [UPD()](../globals/#upd) for a delayed change.

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

The version of the library.

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