diff --git a/fetch-polyfill.js b/fetch-polyfill.js index e1120ae..7530cc7 100644 --- a/fetch-polyfill.js +++ b/fetch-polyfill.js @@ -1,10 +1,12 @@ 'use strict'; +var self = this || global; + // Polyfill from https://github.com/github/fetch/blob/v1.1.1/fetch.js#L8-L21 var support = { - searchParams: 'URLSearchParams' in this, - iterable: 'Symbol' in this && 'iterator' in Symbol, - blob: 'FileReader' in this && 'Blob' in this && (function() { + searchParams: 'URLSearchParams' in self, + iterable: 'Symbol' in self && 'iterator' in Symbol, + blob: 'FileReader' in self && 'Blob' in self && (function() { try { new Blob() return true @@ -12,8 +14,8 @@ var support = { return false } })(), - formData: 'FormData' in this, - arrayBuffer: 'ArrayBuffer' in this + formData: 'FormData' in self, + arrayBuffer: 'ArrayBuffer' in self } // Polyfill from https://github.com/github/fetch/blob/v1.1.1/fetch.js#L364-L375