Turn any window method to a writable state in IE<=8
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.eslintrc
.travis.yml
.zuul.yml
HISTORY.md
LICENSE
index.js
package.json
readme.md
test.js

readme.md

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.