Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #12

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,612 changes: 2,345 additions & 1,267 deletions dist/polyfill.js

Large diffs are not rendered by default.

36 changes: 24 additions & 12 deletions dist/polyfill.js.map

Large diffs are not rendered by default.

79 changes: 62 additions & 17 deletions dist/polyfill.min.js

Large diffs are not rendered by default.

38 changes: 29 additions & 9 deletions dist/polyfill.min.js.map

Large diffs are not rendered by default.

35 changes: 30 additions & 5 deletions index.es6.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const
{ ReadableStream } = require('./spec/reference-implementation/lib/readable-stream'),
{ WritableStream } = require('./spec/reference-implementation/lib/writable-stream'),
ByteLengthQueuingStrategy = require('./spec/reference-implementation/lib/byte-length-queuing-strategy'),
CountQueuingStrategy = require('./spec/reference-implementation/lib/count-queuing-strategy'),
TransformStream = require('./spec/reference-implementation/lib/transform-stream').TransformStream;
{ ByteLengthQueuingStrategy } = require('./spec/reference-implementation/lib/byte-length-queuing-strategy'),
{ CountQueuingStrategy } = require('./spec/reference-implementation/lib/count-queuing-strategy'),
{ TransformStream } = require('./spec/reference-implementation/lib/transform-stream');

const interfaces = {
ReadableStream,
Expand All @@ -16,6 +16,31 @@ const interfaces = {
// Export
export default interfaces;

function getGlobals(){
if(typeof self !== 'undefined'){
return self;
}else if(typeof window !== 'undefined'){
return window;
}else if(typeof global !== 'undefined'){
return global;
}
}

function assignInterfaces(globals, interfaces){
for(let i in interfaces){
// prefer native implementation if available
if(typeof globals[i] === 'undefined'){
globals[i] = interfaces[i];
}else{
let _forcePolyfill = function(){
globals[i] = interfaces[i];
}
globals[i].forcePolyfill = _forcePolyfill;
globals[i].prototype.forcePolyfill = _forcePolyfill;
}
}
}

const globals = getGlobals();
// Add classes to window
if ( typeof window !== "undefined" )
Object.assign( window, interfaces );
assignInterfaces(globals, interfaces);
82 changes: 0 additions & 82 deletions npm-shrinkwrap.json

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@
"uglifyify": "^3.0.2",
"yarn": "^0.17.0"
},
"dependencies": {}
"dependencies": {
"better-assert": "^1.0.2"
}
}
2 changes: 1 addition & 1 deletion spec
Submodule spec updated 105 files