One representation of a {@link NotebookCellOutput notebook output}, defined by MIME type and data.

Static methods

staticerror(value:Error):NotebookCellOutputItem

Factory function to create a NotebookCellOutputItem that uses uses the application/vnd.code.notebook.error mime type.

Parameters:

value

An error object.

Returns:

A new output item object.

staticjson(value:Any, ?mime:String):NotebookCellOutputItem

Factory function to create a NotebookCellOutputItem from a JSON object.

Note that this function is not expecting "stringified JSON" but an object that can be stringified. This function will throw an error when the passed value cannot be JSON-stringified.

Parameters:

value

A JSON-stringifyable value.

mime

Optional MIME type, defaults to application/json

Returns:

A new output item object.

staticstderr(value:String):NotebookCellOutputItem

Factory function to create a NotebookCellOutputItem that uses uses the application/vnd.code.notebook.stderr mime type.

Parameters:

value

A string.

Returns:

A new output item object.

staticstdout(value:String):NotebookCellOutputItem

Factory function to create a NotebookCellOutputItem that uses uses the application/vnd.code.notebook.stdout mime type.

Parameters:

value

A string.

Returns:

A new output item object.

statictext(value:String, ?mime:String):NotebookCellOutputItem

Factory function to create a NotebookCellOutputItem from a string.

Note that an UTF-8 encoder is used to create bytes for the string.

Parameters:

value

A string.

mime

Optional MIME type, defaults to text/plain.

Returns:

A new output item object.

Constructor

new(data:Uint8Array, mime:String)

Create a new notebook cell output item.

Parameters:

data

The value of the output item.

mime

The mime type of the output item.

Variables

data:Uint8Array

The data of this output item. Must always be an array of unsigned 8-bit integers.

mime:String

The mime type which determines how the {@linkcode NotebookCellOutputItem.data data}-property is interpreted.

Notebooks have built-in support for certain mime-types, extensions can add support for new types and override existing types.