writable-window-method

1.0.3 • Public • Published

writable-window-method Version Badge

Build Status License Downloads

Browser tests

Turn any window property to a writable state in IE <= 8.

npm install writable-window-method --save[-dev]

Example

var writable = require('writable-window-method');
 
writable([
  'XMLHttpRequest',
  'Date',
  'setTimeout'
]);
 
function XMLHttpRequest() {
  console.log('Owned');
}
 
var noNative = new XMLHttpRequest();
// 'Owned'
 
var xhr = new writable.original.XMLHttpRequest();
// a real XMLHttpRequest instance

API

writable([propNames, ..])

Pass an array of property names to make them writable. This does not change the behavior of the original properties, it just make them writable for you.

writable.original.propName

Access the original window.propName you made writable just before.

writable.restore()

Restore all writable properties to their original versions.

Populated with every new XMLHttpRequest() or new XDomainRequest().

All requests have the original properties/methods from the spec.

We also added a couple of handy properties/methods for you to ease testing.

Development

npm run dev

Go to http://localhost:8080/__zuul.

Tests are written with tape and run through zuul.

Lint

npm run lint

Uses eslint, see .eslintrc.

Package Sidebar

Install

npm i writable-window-method

Weekly Downloads

714

Version

1.0.3

License

MIT

Last publish

Collaborators

  • vvo