Created
January 27, 2016 05:51
-
-
Save ryanflorence/c3b7347d6814fdb3574f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function(cb) { | |
let counters = 0 | |
if (typeof Promise === 'undefined') { | |
counters++ | |
require.ensure([], (require) => { | |
require('imports?this=>window!es6-promise') | |
decrementCounter() | |
}) | |
} | |
if (typeof fetch === 'undefined') { | |
counters++ | |
require.ensure([], (require) => { | |
require('imports?self=>window!whatwg-fetch') | |
decrementCounter() | |
}) | |
} | |
maybeFinish() | |
function maybeFinish() { | |
if (counters === 0) cb() | |
} | |
function decrementCounter() { | |
counters-- | |
maybeCallback() | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment