Skip to content

Commit

Permalink
Fix for named-register extra. Resolves systemjs#2040. (systemjs#2042)
Browse files Browse the repository at this point in the history
* Fix for named-register extra. Resolves systemjs#2040.

* Guy's feedback
  • Loading branch information
joeldenning authored Oct 6, 2019
1 parent 958aa91 commit 5d12e50
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/extras/named-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,26 @@
* System.register('x', ...) can be imported as System.import('x')
*/
(function () {
setRegisterRegistry(System);
const systemJSPrototype = System.constructor.prototype;

const constructor = System.constructor;
const SystemJS = function () {
constructor.call(this);
this.registerRegistry = Object.create(null);
setRegisterRegistry(this);
};
SystemJS.prototype = systemJSPrototype;
System = new SystemJS();
System.constructor = SystemJS;

let firstNamedDefine;

function clearFirstNamedDefine () {
firstNamedDefine = null;
}

function setRegisterRegistry(systemInstance) {
systemInstance.registerRegistry = Object.create(null);
}

const register = systemJSPrototype.register;
systemJSPrototype.register = function (name, deps, declare) {
if (typeof name !== 'string')
Expand Down

0 comments on commit 5d12e50

Please sign in to comment.