1.3.1 • Published 10 years ago

popupjs v1.3.1

Weekly downloads
33
License
-
Repository
github
Last release
10 years ago

popupjs

Simple popup/modal/dialog component to replace browser dialogs.

Install

npm install --save popupjs

Usage

var popup = require('popupjs')

var example = popup(opts)

Options:

  • content – the html string that will be the body of the popup
  • buttons – optional array of objects used to create buttons
  • template – optional lodash.template, handlebars, or similar template

Example button object:

{
  text: 'OK',
  className: 'confirm',
  fn: function () {
    // some optional action
    // if omitted the remove() method is called
  }
}

example.show()

example.update(data)

data is an object with content and buttons properties, like when creating a popup instance.

example.remove()

Example

var popup = require('./index')

var info = popup({
  content: 'This is pretty fun'
}).show()

Events

example.on('show', function () {})

example.on('update', function (data, html) {})

example.on('remove', function () {})

CSS

A very basic stylsheet is in the style.css file. You could import it using something like rework-npm-cli.

License

MIT

1.3.1

10 years ago

1.3.0

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago