{"action":"created","issue":{"url":"https://api.github.com/repos/systemjs/systemjs/issues/261","repository_url":"https://api.github.com/repos/systemjs/systemjs","labels_url":"https://api.github.com/repos/systemjs/systemjs/issues/261/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/systemjs/issues/261/comments","events_url":"https://api.github.com/repos/systemjs/systemjs/issues/261/events","html_url":"https://github.com/systemjs/systemjs/issues/261","id":50599183,"number":261,"title":"Synchronous import with SystemJs","user":{"login":"jbe456","id":4415696,"avatar_url":"https://avatars.githubusercontent.com/u/4415696?v=3","gravatar_id":"","url":"https://api.github.com/users/jbe456","html_url":"https://github.com/jbe456","followers_url":"https://api.github.com/users/jbe456/followers","following_url":"https://api.github.com/users/jbe456/following{/other_user}","gists_url":"https://api.github.com/users/jbe456/gists{/gist_id}","starred_url":"https://api.github.com/users/jbe456/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbe456/subscriptions","organizations_url":"https://api.github.com/users/jbe456/orgs","repos_url":"https://api.github.com/users/jbe456/repos","events_url":"https://api.github.com/users/jbe456/events{/privacy}","received_events_url":"https://api.github.com/users/jbe456/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-12-02T00:49:23Z","updated_at":"2016-06-23T15:59:38Z","closed_at":"2014-12-03T01:06:16Z","body":"I know there is already a ticket with the same title (https://github.com/systemjs/systemjs/issues/191) but it looks like there is no solution provided for the initial requirement.\r\n\r\nI have an ES6 library that I transpile in ES5 using Traceur. In the end, I would like anybody to be able to use my library either with CommonJS, AMD or directly as a root variable. All the code is downloaded once and available at the time I do get the module.\r\n\r\nI tried this but it doesn't work because modules are loaded asynchronously \r\n```\r\n(function (root, name, definition) {\r\n    if (typeof module != 'undefined') {\r\n    \tmodule.exports = definition();\r\n    } else if (typeof define == 'function' && typeof define.amd == 'object'){\r\n    \tdefine(name, definition);\r\n    } else {\r\n    \troot[name] = definition();\r\n    }\r\n}(this, 'ApplicationName', function() {\r\n    var MyApplication = System.get('MyApplicationBootstrap').default;\r\n    return new MyApplication();\r\n}));\r\n```\r\n\r\nSo for now I ended up doing a jQuery like syntax with an `onReady` method. But it's ugly to have an asynchronous call once the library is loaded in the AMD. It should come ready to use.\r\n\r\nAm I misusing the System.js library ? is it impossible ?"},"comment":{"url":"https://api.github.com/repos/systemjs/systemjs/issues/comments/228097471","html_url":"https://github.com/systemjs/systemjs/issues/261#issuecomment-228097471","issue_url":"https://api.github.com/repos/systemjs/systemjs/issues/261","id":228097471,"user":{"login":"jamesj2","id":1355847,"avatar_url":"https://avatars.githubusercontent.com/u/1355847?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesj2","html_url":"https://github.com/jamesj2","followers_url":"https://api.github.com/users/jamesj2/followers","following_url":"https://api.github.com/users/jamesj2/following{/other_user}","gists_url":"https://api.github.com/users/jamesj2/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesj2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesj2/subscriptions","organizations_url":"https://api.github.com/users/jamesj2/orgs","repos_url":"https://api.github.com/users/jamesj2/repos","events_url":"https://api.github.com/users/jamesj2/events{/privacy}","received_events_url":"https://api.github.com/users/jamesj2/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T15:59:38Z","updated_at":"2016-06-23T15:59:38Z","body":"I haven't found a good solution to the synchronize import issue for my legacy apps.  So I ended up using the promise from System.import.  Yes you'll still have a bunch more refactoring but it's for the better right?\r\n\r\n```\r\nSystem.ready = System.import('/bootstrap').then(function () { ... }\r\nSystem.ready.then(function() { ... });\r\n```\r\n\r\nvs\r\n\r\n`$(document).ready(function () { ... });`"}}
{"actor":{"display_login":"jamesj2"}}