---
title: "Riferimento dell'app"
project: Total.js UI Builder
version: 1.0
section: development
language: it
license: MIT
url: https://totaljs.es/docs/it/uibuilder/1-0/development/app-api/
updated: 2026-11-20T06:51:57.969Z
---

# Riferimento dell'app

> L'oggetto app di un design e l'oggetto UIBuilder della pagina, come li usano i componenti e le app che li ospitano.

Ogni design su una pagina è un'app. Un componente la raggiunge come `instance.app`. La pagina che UI Builder pubblica la tiene come `window.app`, così puoi provare queste chiamate nella console del browser.

La pagina ha anche un unico oggetto `UIBuilder` per tutti i design.

## API

### app.input(id, data, [callback])

Type: `method`

Invia dati a un ingresso del design.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | `String` | yes |  | L'id dell'ingresso, per esempio `cid6wh0tx52_set`. |
| `data` | `Object` | yes |  | I dati. |
| `callback` | `Function` | no |  | Riceve un testo di errore quando l'istanza o l'ingresso non esiste. |

Example: Impostare uno Stepper a 2
```js
app.input('cid6wh0tx52_set', 2, function(err) {
	err && console.log(err);
});
```

### app.on(name, fn)

Type: `method`

Registra un gestore per un evento del design.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Il nome dell'evento. |
| `fn` | `Function` | yes |  | Il gestore. |

Gli eventi sono `output`, `change`, `ready` e `io`.

### app.on('output', function(meta) {})

Type: `event`

Un'istanza ha inviato un'uscita.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `meta` | `Object` | yes |  | L'uscita. |

`meta.id` è l'id dell'uscita nel design, `meta.ref` il suo id nel componente, `meta.data` i dati, `meta.err` un errore o `null`, e `meta.instance`, `meta.component` e `meta.app` gli oggetti.

Example: Registrare nel log ogni uscita
```js
app.on('output', function(meta) {
	console.log(meta.id, meta.data);
});
```

### app.on('change', function(instance) {})

Type: `event`

Lo stato di un'istanza è cambiato.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `instance` | `Object` | yes |  | L'istanza. |

Viene emesso 50 ms dopo l'ultima modifica di ogni istanza.

### app.on('ready', function() {})

Type: `event`

Tutte le istanze sono state costruite.

### app.find(id)

Type: `method`

Trova un'istanza.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | `String` | yes |  | L'id, `@` e l'id, oppure `.` e un percorso. |

Returns: `Object` L'istanza.

### app.instances

Type: `property`

Tutte le istanze del design.

### app.args

Type: `property`

I **Dynamic arguments** (argomenti dinamici) del design.

### app.query

Type: `property`

Gli argomenti della query nell'indirizzo della pagina.

### app.schema

Type: `property`

Il design così come è stato costruito.

### app.element

Type: `property`

L'elemento del design, un oggetto jQuery.

### UIBuilder.editor

Type: `property`

`true` nell'editor, non impostato in un design pubblicato.

### UIBuilder.on(name, fn)

Type: `method`

Registra un gestore per tutti i design della pagina.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Il nome dell'evento. |
| `fn` | `Function` | yes |  | Il gestore. |

`output` riceve le uscite di ogni design, con lo stesso `meta` di `app.on('output')`. `app` viene eseguito quando un design è costruito.

### UIBuilder.build(target, design, [callback])

Type: `method`

Costruisce un design pubblicato dentro un elemento.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `target` | `Element` | yes |  | Dove mettere il design. |
| `design` | `Object` | yes |  | Il design pubblicato, come in `_render.json`, o il suo testo JSON. |
| `callback` | `Function` | no |  | Riceve l'app. |

Returns: `Object` L'app.

La pagina pubblicata la chiama con il contenuto del design. Il design ha bisogno di `components` e `children`; un design che è già sulla pagina viene prima rimosso.

Example: Costruire un design
```js
AJAX('GET /designs/demo_render.json', function(design) {
	UIBuilder.build('#design', design, function(app) {
		app.on('output', console.log);
	});
});
```
