faux-moz-dom

1.0.0 • Public • Published

faux-moz-dom

At this point, I’m not even sold on this being a good idea…

Build status

Install

$ npm install michaelrhodes/faux-moz-dom

Usage

var FauxDOMRequest = require('faux-moz-dom/request')
var FauxDOMCursor = require('faux-moz-dom/cursor')

var requestSomething = function () {
  var request = new FauxDOMRequest

  setTimeout(function () {
    request.readyState = 'done'
    request.result = 'Great job!'
    if (typeof request.onsuccess === 'function') {
      request.onsuccess()
    }
  })

  return request
}

var badCursor = function () {
  var cursor = new FauxDOMCursor

  setTimeout(function () {
    cursor.readyState = 'done'
    cursor.error = new DOMError('NO_GO')
    if (typeof cursor.onerror === 'function') {
      cursor.onerror()
    }
  })

  return cursor
}

License

MIT

Package Sidebar

Install

npm i faux-moz-dom

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • michaelrhodes