Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Use API functions based on availability #228

Closed
wants to merge 4 commits into from
Closed

Use API functions based on availability #228

wants to merge 4 commits into from

Conversation

mo22
Copy link

@mo22 mo22 commented Oct 10, 2014

Hi,
I'm using es6-module-loader in a custom javascript environment and made these changes to avoid errors.
I have a window object, but do not have a document.getElementsByTagName, I have an XMLHttpRequest but no require.

@mo22 mo22 closed this Oct 10, 2014
@mo22 mo22 reopened this Oct 10, 2014
@mo22
Copy link
Author

mo22 commented Oct 10, 2014

also support pre-transpiled modules - check if the source starts with System.register, if yes, do not transpile.

@@ -5,7 +5,7 @@ function __eval(__source, __global, load) {
// Hijack System.register to set declare function
var __curRegister = System.register;
System.register = function(name, deps, declare) {
if (typeof name != 'string') {
if (typeof name != 'string' && typeof name != 'void') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is outputting a void in the System.register name? That should never happen and if it does that is the wrong output mode in Traceur (this sounds like the Traceur register output).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, that is a good question. You're right, name should never be void, that would not make sense.
Maybe just assert that it is not void?

@guybedford
Copy link
Member

The environment changes all look pretty good, but would be good to separate this from the commented points.

@guybedford
Copy link
Member

Thanks, I've merged the relevant parts in now.

@guybedford guybedford closed this Oct 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants