1.0.1 • Published 9 years ago

atom-quick-pane v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

atom-quick-pane

stable

Quick and easy pane creation for Atom.

It was difficult finding documentation for how to set up a new pane that just required dealing with a <div> or custom element, and there's still the need to adhere to Atom's Model/View pattern currently. This package provides a simpler API for one-off panes when that's all you need.

Usage

NPM

pane(options, setup, teardown)

All options and arguments are optional.

Options

  • options.title: the title to include in the tab for the pane.
  • options.split: either 'left' or 'right'.
  • options.activatePane: A Boolean indicating whether to call Pane::activate on containing pane. Defaults to true.
  • options.element: the element to use for the contents of the pane. This may be one of:
    • a string node name, e.g. div or table.
    • a function/constructor returning a new HTMLElement.
    • an existing HTMLElement.

setup(err, element)

Called when the pane is created and set up in the editor. element is the result of options.element.

teardown()

Called when the pane has been closed and needs to be cleaned up.

Example

const Pane = require('atom-quick-pane')

Pane({
  element: 'div',
  title: 'Hello World!'
}, function (err, div) {
  if (err) throw err

  div.innerHTML = 'Hi there!'
}, function () {
  // clean up any event listeners or other resources here
})

License

MIT, see LICENSE.md for details.