Il metodo statico Atomics.store() memorizza un determinato valore nella posizione data nell'array e restituisce quel valore.

Sintassi

Atomics.store(typedArray, indice, valore)

Parameters

typedArray
Un array con numero intero condiviso. Uno di Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, o Uint32Array.
indice
La posizione in typedArray per memorizzare un  value in.
valore
Numero da memorizzare.

Valore di Ritorno

The value that has been stored
// Il valore memorizzato.

Eccezioni

  • Genera un TypeError, se typedArray non è uno dei tipi di numeri consentiti.
  • Genera un TypeError, se typedArray non è un tipo di array tipizzato condiviso.
  • Genera un RangeError, se indice è fuori limite in typedArray.

Esempio

var buffer = new ArrayBuffer(4);         // common buffer
var float32 = new Float32Array(buffer);  // floating point
var uint32 = new Uint32Array(buffer);    // IEEE754 representation

float32[0] = 0.5;
console.log("0x" + uint32[0].toString(16));

uint32[0] = 0x3f000000;   /// IEEE754 32-bit representation of 0.5
console.log(float32[0]);

Specificazioni

Specificazioni Stato Commenti
ECMAScript Latest Draft (ECMA-262)
The definition of 'Atomics.store' in that specification.
Draft definizione inizile in ES2017.

Browser compatibili

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung InternetNode.js
Basic supportChrome Full support 68
Full support 68
No support 60 — 63
Notes
Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place.
Edge Full support 16
Notes
Full support 16
Notes
Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog).
Firefox Full support 57
Notes Disabled
Full support 57
Notes Disabled
Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog).
Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No support 55 — 57
No support 46 — 55
Disabled
Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera No support NoSafari No support 10.1 — ?WebView Android No support 60 — 63
Notes
No support 60 — 63
Notes
Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.
Chrome Android No support 60 — 63
Notes
No support 60 — 63
Notes
Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.
Edge Mobile ? Firefox Android Full support 57
Notes Disabled
Full support 57
Notes Disabled
Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog).
Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No support 55 — 57
No support 46 — 55
Disabled
Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs Full support 8.10.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.

Vedi anche

Tag del documento e collaboratori

Hanno collaborato alla realizzazione di questa pagina: ladysilvia
Ultima modifica di: ladysilvia,