Skip to content

Instantly share code, notes, and snippets.

View rconnamacher's full-sized avatar

Richard Connamacher rconnamacher

View GitHub Profile
@rconnamacher
rconnamacher / devLoader.js
Created August 25, 2017 02:55
Importing Closure Library into Browser-Native ES6 Modules
/**
* @fileinfo
*
* This ES6 module attempts to load Closure-managed dependencies from native ES6 modules
* in web browsers (as supported today in Safari, fall 2017 in Chrome, and behind feature
* flags in Edge and Firefox).
*
* To use: just import this into a natively-loaded ES6 module that will be using
*
/**
* Copyright (c) 2016-2018 Richard Connamacher. Permission is granted to use this code under
* the terms of the Simplified BSD License, https://opensource.org/licenses/BSD-2-Clause
*
* This monkey-patches the native ECMAScript 6 Promise class to add support for
* the Promise Rejection Events unhandledrejection and rejectionhandled, as defined
* in ECMAScript 7 and the HTML Living Standard.
*
* THIS FILE MUST NOT BE TRANSPILED into ECMAScript 5. Builtins like Promise can only
* be subclassed using native ES6 classes, not backwards-compatible ES5 constructor