Closed vvo closed 8 years ago
Hi For polyfill need a browser. Why do you need a polyfill without a browser?
I mean something where I could do var History = require('html5-history-api')
so that I do not overwrite the full window.history.
I am developing some code that should be able to be inserted in a lot of different website so I cannot just erase the full window.history.
I do not quite understand. Can you describe in more detail your situation. Thank you!
I want to be able to require and use your library without it being inserted automatically in the global scope and replacing the original history object.
var History = require('html5-history-api')
History.pushState();
History.on('popstate')
// etc..
You want this library to fully simulate the History-API without a browser?
CommonJS is used within the browser via toolchains like Browserify and Webpack. I believe this is how @vvo will use the library. So instead of providing the global window.history.location
, you would be able to use the library via var location = require("html5-history-api")
Exactly what @flipchart said :-). Why do this? Because if you are a library author you do not want to pollute the original document by providing a polyfill in window.history while the website author may have some scripts expecting it not to exists.
Added support CommonJS
Hi, could we have commonJS support? thx