Skip to content

JsMind ​

Preview version

The jsMind V2 programming API is currently a preview. The API will change in later updates. Please check this documentation anytime for the interface that is current.

The default export of the jsmind package. In the UMD build it is also available as the global jsMind.

This page is generated from the published typings dist/jsmind.d.ts with TypeDoc.

JsMind ​

Class

Main class for jsMind mind map operations.

mind ​

ts
mind: JmMind | null

The currently opened mind map, or null if none is open.

options ​

ts
options: JsMindOptions

The options for this jsMind instance.

Mind ​

ts
static Mind: typeof JmMind

The mind map model class. Construct a map with new jsMind.Mind(), then pass it to JsMind.open.

NodeSide ​

ts
static NodeSide: { Center: 0; SideA: 1; SideB: -1 }

Node side values used when placing a node to the left, right, or center. Same object as the JmNodeSide enumeration in the typings.

Serializer ​

ts
static Serializer: typeof JmMindSerializerFactory

Factory for serializers. jsMind.Serializer.create('json') and jsMind.Serializer.create('freemind') are the supported formats.

Author ​

ts
static get Author(): string

Gets the author of jsMind.

Returns: The author string.

Version ​

ts
static get Version(): string

Gets the version of jsMind.

Returns: The version string.

close ​

ts
close(): void

Closes the current mind map, if one is open.

After close, JsMind.mind is null until you JsMind.open another map.

exportImage ​

ts
exportImage(options?: JmExportImageOptions): Promise<JmExportImageResult>

Renders the open mind map to an image.

The size is the rendered content's own size: whitespace inside the container is part of the picture, and a map larger than its container is not cropped.

Returns: The encoded image, as a Blob, plus its pixel dimensions.

Throws

  • JsMindError If no mind map is open, or if the browser cannot encode the result.

Parameters

NameTypeDescription
options (optional)JmExportImageOptionsScale, format, quality and background transparency. Defaults to PNG at 2x.

open ​

ts
open(mind: JmMind): Promise<void>

Opens a mind map.

Returns: A promise that resolves when the mind map has been opened.

Parameters

NameTypeDescription
mindJmMindThe mind map instance to open.

serialize ​

ts
serialize(): string

Serializes the current mind map to JSON.

Returns: JSON string representation of the mind map.

Throws

  • Error If no mind map is open or serialization fails.

create ​

ts
static create(container: string | HTMLElement, options?: JsMindOptions): Promise<JsMind>

Creates a jsMind instance and attaches its view to a container.

Returns: A promise that resolves to the new instance. No mind map is open yet; call JsMind.open with a JmMind to display one.

Parameters

NameTypeDescription
containerstring | HTMLElementThe container element, or the id of an element in the document.
options (optional)JsMindOptionsConfiguration for the instance. Omitted fields use the library defaults.

本文档由 AI 协助生成 / This documentation was prepared with AI assistance