Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.08 KB

README.md

File metadata and controls

51 lines (35 loc) · 1.08 KB

Luna Object Viewer

JavaScript object viewer, useful for building debugging tool.

Demo

https://luna.liriliri.io/?path=/story/object-viewer

Install

Add the following script and style to your page.

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-object-viewer/luna-object-viewer.css" />
<script src="//cdn.jsdelivr.net/npm/luna-object-viewer/luna-object-viewer.js"></script>

You can also get it on npm.

npm install luna-object-viewer --save
import 'luna-object-viewer/luna-object-viewer.css'
import LunaObjectViewer from 'luna-object-viewer'

Usage

const container = document.getElementById('container')
const objectViewer = new LunaObjectViewer(container, {
  unenumerable: false,
  accessGetter: true,
})
objectViewer.set(window.navigator)

Configuration

  • accessGetter(boolean): Access getter value.
  • object(any): JavaScript object to display.
  • prototype(boolean): Show prototype.
  • unenumerable(boolean): Show unenumerable properties.

Api

set(data: any): void

Set the JavaScript object to display.