diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
commit | a065e04d529da1d847b5062a12c46d916408bf32 (patch) | |
tree | fe0f8bcec1ff39a3c499a2708222dcf15224ff70 /files/it/web/javascript/reference/global_objects | |
parent | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (diff) | |
download | translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.gz translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.bz2 translated-content-a065e04d529da1d847b5062a12c46d916408bf32.zip |
update based on https://github.com/mdn/yari/issues/2028
Diffstat (limited to 'files/it/web/javascript/reference/global_objects')
-rw-r--r-- | files/it/web/javascript/reference/global_objects/function/arity/index.html | 26 | ||||
-rw-r--r-- | files/it/web/javascript/reference/global_objects/object/observe/index.html | 189 |
2 files changed, 0 insertions, 215 deletions
diff --git a/files/it/web/javascript/reference/global_objects/function/arity/index.html b/files/it/web/javascript/reference/global_objects/function/arity/index.html deleted file mode 100644 index fec2d9e988..0000000000 --- a/files/it/web/javascript/reference/global_objects/function/arity/index.html +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Function.arity -slug: Web/JavaScript/Reference/Global_Objects/Function/arity -translation_of: Archive/Web/JavaScript/Function.arity ---- -<p>{{JSRef}}{{Obsolete_Header}}</p> - -<div class="blockIndicator note"> -<p>La proprieta' <code><strong>arity</strong></code> ritornava il numero di parametri richiesta da una funzione. Ad ogni modo non esiste piu' ed e' stata rimpiazzata dalla proprieta' {{JSxRef("Function.prototype.length")}}.</p> -</div> - -<h2 id="Specifiche">Specifiche</h2> - -<p>Implementato in JavaScript 1.2. Deprecato in JavaScript 1.4.</p> - -<h2 id="Compatibilita_Browser">Compatibilita' Browser</h2> - - - -<p>{{Compat("javascript.builtins.Function.arity")}}</p> - -<h2 id="Guarda_anche">Guarda anche</h2> - -<ul> - <li>{{JSxRef("Function.prototype.length")}}</li> -</ul> diff --git a/files/it/web/javascript/reference/global_objects/object/observe/index.html b/files/it/web/javascript/reference/global_objects/object/observe/index.html deleted file mode 100644 index 4307b4e75f..0000000000 --- a/files/it/web/javascript/reference/global_objects/object/observe/index.html +++ /dev/null @@ -1,189 +0,0 @@ ---- -title: Object.observe() -slug: Web/JavaScript/Reference/Global_Objects/Object/observe -translation_of: Archive/Web/JavaScript/Object.observe ---- -<div>{{JSRef}} {{obsolete_header}}</div> - -<h2 id="Sommario">Sommario</h2> - -<p>Il metodo <strong><code>Object.observe()</code></strong> è usato per l'osservazione asincrona dei cambiamenti di un oggetto. Esso fornisce uno stream dei cambiamenti nell'ordine in cui si verificano.</p> - -<h2 id="Sintassi">Sintassi</h2> - -<pre class="syntaxbox"><code>Object.observe(<var>obj</var>, <var>callback</var>[, <var>acceptList</var>])</code></pre> - -<h3 id="Parametri">Parametri</h3> - -<dl> - <dt><code>obj</code></dt> - <dd>L'oggetto che verrà osservato.</dd> - <dt><code>callback</code></dt> - <dd>La funzione richiamata ogni volta che si verificano delle modifiche, con i seguenti argomenti: - <dl> - <dt><code>changes</code></dt> - <dd>Un array di oggetti di oggetti che rappresentano una modifica. Le properties di questi oggetti sono: - <ul> - <li><strong><code>name</code></strong>: Il nome della property che è stata modificata.</li> - <li><strong><code>object</code></strong>: L'oggetto modificato dopo che la modifica è avvenuta.</li> - <li><strong><code>type</code></strong>: Una stringa che indica il tipo di modifica in atto. Può essere valorizzata con <code>"add"</code>, <code>"update"</code> o <code>"delete"</code>.</li> - <li><strong><code>oldValue</code></strong>: Solo per i tipi <code>"update"</code> e <code>"delete"</code>. Indica il valore prima della modifica.</li> - </ul> - </dd> - </dl> - </dd> - <dt><code>acceptList</code></dt> - <dd>La lista dei tipi di modifiche che possono essere osservate su un dato oggetto per un dato callback. Se omesso, sarà usato l'array <code>["add", "update", "delete", "reconfigure", "setPrototype", "preventExtensions"]</code>.</dd> -</dl> - -<h2 id="Descrizione">Descrizione</h2> - -<p>La funzione <code>callback</code> è chiamata ogni volta che una modifica viene fatta sull'<span style="font-family: Consolas,Monaco,'Andale Mono',monospace;">obj.</span> Ad essa viene passata un'array di tutte le modifiche, nell'ordine in cui si verificano.</p> - -<h2 id="Esempi">Esempi</h2> - -<h3 id="Esempio_Log_di_tutti_e_sei_differenti_tipi">Esempio: Log di tutti e sei differenti tipi</h3> - -<pre class="brush: js">var obj = { - foo: 0, - bar: 1 -}; - -Object.observe(obj, function(changes) { - console.log(changes); -}); - -obj.baz = 2; -// [{name: 'baz', object: <obj>, type: 'add'}] - -obj.foo = 'hello'; -// [{name: 'foo', object: <obj>, type: 'update', oldValue: 0}] - -delete obj.baz; -// [{name: 'baz', object: <obj>, type: 'delete', oldValue: 2}] - -Object.defineProperty(obj, 'foo', {writable: false}); -// [{name: 'foo', object: <obj>, type: 'reconfigure'}] - -Object.setPrototypeOf(obj, {}); -// [{name: '__proto__', object: <obj>, type: 'setPrototype', oldValue: <prototype>}] - -Object.seal(obj); -// [ -// {name: 'foo', object: <obj>, type: 'reconfigure'}, -// {name: 'bar', object: <obj>, type: 'reconfigure'}, -// {object: <obj>, type: 'preventExtensions'} -// ] -</pre> - -<h3 id="Esempio_Data_Binding">Esempio: Data Binding</h3> - -<pre class="brush: js">// A user model -var user = { - id: 0, - name: 'Brendan Eich', - title: 'Mr.' -}; - -// Create a greeting for the user -function updateGreeting() { - user.greeting = 'Hello, ' + user.title + ' ' + user.name + '!'; -} -updateGreeting(); - -Object.observe(user, function(changes) { - changes.forEach(function(change) { - // Any time name or title change, update the greeting - if (change.name === 'name' || change.name === 'title') { - updateGreeting(); - } - }); -}); -</pre> - -<h3 id="Esempio_Tipo_di_modifica_personalizzata">Esempio: Tipo di modifica personalizzata</h3> - -<pre class="brush: js">// A point on a 2D plane -var point = {x: 0, y: 0, distance: 0}; - -function setPosition(pt, x, y) { - // Performing a custom change - Object.getNotifier(pt).performChange('reposition', function() { - var oldDistance = pt.distance; - pt.x = x; - pt.y = y; - pt.distance = Math.sqrt(x * x + y * y); - return {oldDistance: oldDistance}; - }); -} - -Object.observe(point, function(changes) { - console.log('Distance change: ' + (point.distance - changes[0].oldDistance)); -}, ['reposition']); - -setPosition(point, 3, 4); -// Distance change: 5 -</pre> - -<h2 id="Specifications" name="Specifications">Specifiche</h2> - -<p><a href="https://github.com/arv/ecmascript-object-observe">Argomentazione proposta per ECMAScript 7</a>.</p> - -<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilita browser</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Caratteristica</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Supporto base</td> - <td>{{CompatChrome("36")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera("23")}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Supporto base</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome("36")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera("23")}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="See_also" name="See_also">Vedi anche</h2> - -<ul> - <li>{{jsxref("Object.unobserve()")}} {{experimental_inline}}</li> - <li>{{jsxref("Array.observe()")}} {{experimental_inline}}</li> -</ul> |