Skip to content

Latest commit

 

History

History
47 lines (41 loc) · 1.04 KB

readme.md

File metadata and controls

47 lines (41 loc) · 1.04 KB

XMind Embed Viewer

Quick start

Demo

Document

Initialization

import { XMindEmbedViewer } from 'xmind-embed-viewer'
// Intialize a viewer isntance
const viewer = new XMindEmbedViewer({
  el: document.querySelector('#container-or-iframe')
})

Methods

Load file into viewer

// Download remote file and load into the viewer isntance
fetch('test-1.xmind')
  .then(res => res.arrayBuffer())
  .then(file => viewer.load(file))

Get viewer state

console.log('Current zoomscales: ', viewer.zoomScale)
console.log('Current activated sheet id: ', viewer.currentSheetId)
console.log('All Sheets: ', viewer.sheets)

Events

Add listener

const callback = (payload) => {
    console.log('Event callback with payload', payload)
}
viewer.addEventListener('event-name', callback)
viewer.removeEventListener('event-name', callback)

Available events:

  • map-ready
  • zoom-change
  • sheet-switch
  • sheets-load

License