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
mind: JmMind | nullThe currently opened mind map, or null if none is open.
options
options: JsMindOptionsThe options for this jsMind instance.
Mind
static Mind: typeof JmMindThe mind map model class. Construct a map with new jsMind.Mind(), then pass it to JsMind.open.
NodeSide
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
static Serializer: typeof JmMindSerializerFactoryFactory for serializers. jsMind.Serializer.create('json') and jsMind.Serializer.create('freemind') are the supported formats.
Author
static get Author(): stringGets the author of jsMind.
Returns: The author string.
Version
static get Version(): stringGets the version of jsMind.
Returns: The version string.
close
close(): voidCloses the current mind map, if one is open.
After close, JsMind.mind is null until you JsMind.open another map.
exportImage
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
JsMindErrorIf no mind map is open, or if the browser cannot encode the result.
Parameters
| Name | Type | Description |
|---|---|---|
options (optional) | JmExportImageOptions | Scale, format, quality and background transparency. Defaults to PNG at 2x. |
open
open(mind: JmMind): Promise<void>Opens a mind map.
Returns: A promise that resolves when the mind map has been opened.
Parameters
| Name | Type | Description |
|---|---|---|
mind | JmMind | The mind map instance to open. |
serialize
serialize(): stringSerializes the current mind map to JSON.
Returns: JSON string representation of the mind map.
Throws
ErrorIf no mind map is open or serialization fails.
create
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
| Name | Type | Description |
|---|---|---|
container | string | HTMLElement | The container element, or the id of an element in the document. |
options (optional) | JsMindOptions | Configuration for the instance. Omitted fields use the library defaults. |