Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 36 additions & 36 deletions files/en-us/learn_web_development/core/scripting/functions/index.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ For more information on JavaScript debugging, see [JavaScript debugging and erro
- [How do you create your own functions?](/en-US/docs/Learn_web_development/Core/Scripting/Build_your_own_function)
- [How do you run (call, or invoke) a function?](/en-US/docs/Learn_web_development/Core/Scripting/Functions#invoking_functions)
- [What is an anonymous function?](/en-US/docs/Learn_web_development/Core/Scripting/Functions#anonymous_functions_and_arrow_functions)
- [How do you specify parameters (or arguments) when invoking a function?](/en-US/docs/Learn_web_development/Core/Scripting/Functions#function_parameters)
- [How do you specify parameters (or arguments) when invoking a function?](/en-US/docs/Learn_web_development/Core/Scripting/Functions#function_arguments_and_parameters)
- [What is function scope?](/en-US/docs/Learn_web_development/Core/Scripting/Functions#function_scope_and_conflicts)
- [What are return values, and how do you use them?](/en-US/docs/Learn_web_development/Core/Scripting/Return_values)

Expand Down
10 changes: 8 additions & 2 deletions files/en-us/mozilla/firefox/releases/153/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ Firefox 153 is the current [Beta version of Firefox](https://www.firefox.com/en-
This provides a convenient mechanism for websites to toggle display of a {{htmlelement("video")}} element between a page and a floating always-on-top video window, allowing users to continue watching while they interact with other sites or applications.
([Firefox bug 1463402](https://bugzil.la/1463402)).

<!-- #### DOM -->
#### DOM

- The [Popover API](/en-US/docs/Web/API/Popover_API) now has more consistent behavior when [`hint` and `auto` popovers are opened and closed](/en-US/docs/Web/API/Popover_API/Using#popover_openclose_interaction_rules).
This follows the specification update in [whatwg/html#12345](https://github.com/whatwg/html/pull/12345).
([Firefox bug 2029974](https://bugzil.la/2029974)).

#### Media, WebRTC, and Web Audio

Expand All @@ -82,7 +86,9 @@ Firefox 153 is the current [Beta version of Firefox](https://www.firefox.com/en-

<!-- #### Removals -->

<!-- ### WebAssembly -->
### WebAssembly

- JavaScript Promise Integration (JS-PI) is now enabled, allowing [WebAssembly](/en-US/docs/WebAssembly) modules to interoperate with asynchronous, {{jsxref("Promise")}}-based JavaScript APIs. This lets WebAssembly code suspend while waiting for a JavaScript promise and resume when the promise settles. See [`WebAssembly.Suspending`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending) for an explanation and working example. ([Firefox bug 2044809](https://bugzil.la/2044809)).

<!-- #### Removals -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ details to the console:
try {
throw new WebAssembly.CompileError("Hello", "someFile", 10);
} catch (e) {
console.log(e instanceof CompileError); // true
console.log(e instanceof WebAssembly.CompileError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "CompileError"
console.log(e.fileName); // "someFile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The following snippet creates a new `CompileError` instance, and logs its detail
try {
throw new WebAssembly.CompileError("Hello", "someFile", 10);
} catch (e) {
console.log(e instanceof CompileError); // true
console.log(e instanceof WebAssembly.CompileError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "CompileError"
console.log(e.fileName); // "someFile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ The primary uses for the `WebAssembly` object are:
- : Contains stateless WebAssembly code that has already been compiled by the browser and can be efficiently [shared with Workers](/en-US/docs/Web/API/Worker/postMessage), and instantiated multiple times.
- [`WebAssembly.RuntimeError`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/RuntimeError)
- : Error type that is thrown whenever WebAssembly specifies a [trap](https://webassembly.github.io/simd/core/intro/overview.html#trap).
- [`WebAssembly.Suspending`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending)
- : Represents a suspending function — an asynchronous ({{jsxref("Promise")}}-based) JavaScript function that, when imported into a Wasm module and called from inside, will result in execution being suspended until the promise resolves.
- [`WebAssembly.Table`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Table)
- : An array-like structure representing a WebAssembly Table, which stores [references](https://webassembly.github.io/spec/core/syntax/types.html#syntax-reftype), such as function references.
- [`WebAssembly.Tag`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Tag)
Expand All @@ -56,6 +58,8 @@ The primary uses for the `WebAssembly` object are:
- : The primary API for compiling and instantiating WebAssembly code, returning both a `Module` and its first `Instance`.
- [`WebAssembly.instantiateStreaming()`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/instantiateStreaming_static)
- : Compiles and instantiates a WebAssembly module directly from a streamed underlying source, returning both a `Module` and its first `Instance`.
- [`WebAssembly.promising()`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/promising_static)
- : Wraps an exported Wasm function that relies on an asynchronous operation (that is, an imported suspending function created via the [`WebAssembly.Suspending()`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending/Suspending) constructor), turning it into a {{jsxref("Promise")}}.
- [`WebAssembly.validate()`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/validate_static)
- : Validates a given typed array of WebAssembly binary code, returning whether the bytes are valid WebAssembly code (`true`) or not (`false`).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The following snippet creates a new `LinkError` instance, and logs its details t
try {
throw new WebAssembly.LinkError("Hello", "someFile", 10);
} catch (e) {
console.log(e instanceof LinkError); // true
console.log(e instanceof WebAssembly.LinkError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "LinkError"
console.log(e.fileName); // "someFile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ details to the console:
try {
throw new WebAssembly.LinkError("Hello", "someFile", 10);
} catch (e) {
console.log(e instanceof LinkError); // true
console.log(e instanceof WebAssembly.LinkError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "LinkError"
console.log(e.fileName); // "someFile"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: WebAssembly.promising()
slug: WebAssembly/Reference/JavaScript_interface/promising_static
page-type: webassembly-function
browser-compat: webassembly.api.promising_static
sidebar: webassemblysidebar
---

The **`WebAssembly.promising()`** static method is used to wrap an exported Wasm function that relies on an asynchronous operation (that is, an imported suspending function created via the [`WebAssembly.Suspending()`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending/Suspending) constructor), turning it into a {{jsxref("Promise")}}.

See [`WebAssembly.Suspending`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending) for an explanation of how this functionality works.

## Syntax

```js-nolint
WebAssembly.promising(function)
```

### Parameters

- `function`
- : A reference to an exported Wasm function, typically available on the [`exports`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Instance/exports) object available in the fulfilled value of a method such as [`WebAssembly.instantiateStreaming()`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/instantiateStreaming_static).

### Return value

A function that wraps the original function passed into the `promising()` call, and can itself be called. The wrapper function takes the same arguments as the wrapped function, and returns a promise that fulfills with the wrapped function's results.

### Exceptions

- {{jsxref("TypeError")}}
- : The referenced `function` is not callable.

## Examples

### Basic usage

```js
WebAssembly.instantiateStreaming(fetch("module.wasm"), { importObj }).then(
(result) => {
const fromWasm = WebAssembly.promising(
result.instance.exports.exportedFunc,
);
fromWasm().then((result) => {
// ...
});
},
);
```

See [`WebAssembly.Suspending`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending) for a full working example.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [`WebAssembly.Suspending`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending)
- [`WebAssembly.Suspending()`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending/Suspending) constructor
- [WebAssembly](/en-US/docs/WebAssembly) overview
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: WebAssembly.SuspendError
slug: WebAssembly/Reference/JavaScript_interface/SuspendError
page-type: webassembly-interface
browser-compat: webassembly.api.SuspendError
sidebar: webassemblysidebar
---

The **`WebAssembly.SuspendError`** object indicates an error during WebAssembly [function suspension](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending).

## Constructor

- [`WebAssembly.SuspendError()`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/SuspendError/SuspendError)
- : Creates a new `WebAssembly.SuspendError` object.

## Instance properties

- {{jsxref("Error.prototype.message", "WebAssembly.SuspendError.prototype.message")}}
- : Error message. Inherited from {{jsxref("Error")}}.
- {{jsxref("Error.prototype.name", "WebAssembly.SuspendError.prototype.name")}}
- : Error name. Inherited from {{jsxref("Error")}}.
- {{jsxref("Error.prototype.cause", "WebAssembly.SuspendError.prototype.cause")}}
- : Error cause. Inherited from {{jsxref("Error")}}.
- {{jsxref("Error.prototype.fileName", "WebAssembly.SuspendError.prototype.fileName")}} {{non-standard_inline}}
- : Path to file that raised this error. Inherited from {{jsxref("Error")}}.
- {{jsxref("Error.prototype.lineNumber", "WebAssembly.SuspendError.prototype.lineNumber")}} {{non-standard_inline}}
- : Line number in file that raised this error. Inherited from {{jsxref("Error")}}.
- {{jsxref("Error.prototype.columnNumber", "WebAssembly.SuspendError.prototype.columnNumber")}} {{non-standard_inline}}
- : Column number in line that raised this error. Inherited from {{jsxref("Error")}}.
- {{jsxref("Error.prototype.stack", "WebAssembly.SuspendError.prototype.stack")}} {{non-standard_inline}}
- : Stack trace. Inherited from {{jsxref("Error")}}.

## Instance methods

- {{jsxref("Error.prototype.toString", "WebAssembly.SuspendError.prototype.toString()")}}
- : Returns a string representing the specified `Error` object. Inherited from {{jsxref("Error")}}.

## Examples

### Creating a new SuspendError instance

The following snippet creates a new `SuspendError` instance, and logs its details to the console:

```js
try {
throw new WebAssembly.SuspendError("Hello", "someFile", 10);
} catch (e) {
console.log(e instanceof WebAssembly.SuspendError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "SuspendError"
console.log(e.fileName); // "someFile"
console.log(e.lineNumber); // 10
console.log(e.columnNumber); // 0
console.log(e.stack); // The location where the code was run
}
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [`WebAssembly.Suspending`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending)
- [WebAssembly](/en-US/docs/WebAssembly) overview
- [WebAssembly concepts](/en-US/docs/WebAssembly/Guides/Concepts)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: WebAssembly.SuspendError() constructor
slug: WebAssembly/Reference/JavaScript_interface/SuspendError/SuspendError
page-type: webassembly-constructor
browser-compat: webassembly.api.SuspendError.SuspendError
sidebar: webassemblysidebar
---

The **`WebAssembly.SuspendError()`** constructor creates a new
WebAssembly `SuspendError` object, which indicates an error during
WebAssembly [function suspension](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending).

## Syntax

```js-nolint
new WebAssembly.SuspendError()
new WebAssembly.SuspendError(message)
new WebAssembly.SuspendError(message, options)
new WebAssembly.SuspendError(message, fileName)
new WebAssembly.SuspendError(message, fileName, lineNumber)
```

### Parameters

- `message` {{optional_inline}}
- : Human-readable description of the error.
- `options` {{optional_inline}}
- : An object that has the following properties:
- `cause` {{optional_inline}}
- : A property indicating the specific cause of the error.
When catching and re-throwing an error with a more-specific or useful error message, this property can be used to pass the original error.
- `fileName` {{optional_inline}} {{non-standard_inline}}
- : The name of the file containing the code that caused the exception.
- `lineNumber` {{optional_inline}} {{non-standard_inline}}
- : The line number of the code that caused the exception.

## Examples

### Creating a new SuspendError instance

The following snippet creates a new `SuspendError` instance, and logs its
details to the console:

```js
try {
throw new WebAssembly.SuspendError("Hello", "someFile", 10);
} catch (e) {
console.log(e instanceof WebAssembly.SuspendError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "SuspendError"
console.log(e.fileName); // "someFile"
console.log(e.lineNumber); // 10
console.log(e.columnNumber); // 0
console.log(e.stack); // The location where the code was run
}
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [`WebAssembly.Suspending`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending)
- [WebAssembly](/en-US/docs/WebAssembly) overview
- [WebAssembly concepts](/en-US/docs/WebAssembly/Guides/Concepts)
Loading