{"action":"created","issue":{"url":"https://api.github.com/repos/ManifestWebDesign/angular-gridster/issues/275","labels_url":"https://api.github.com/repos/ManifestWebDesign/angular-gridster/issues/275/labels{/name}","comments_url":"https://api.github.com/repos/ManifestWebDesign/angular-gridster/issues/275/comments","events_url":"https://api.github.com/repos/ManifestWebDesign/angular-gridster/issues/275/events","html_url":"https://github.com/ManifestWebDesign/angular-gridster/pull/275","id":78091555,"number":275,"title":"Wrap in a UMD module for CommonJS, AMD and browser.","user":{"login":"mikehaas763","id":2096573,"avatar_url":"https://avatars.githubusercontent.com/u/2096573?v=3","gravatar_id":"","url":"https://api.github.com/users/mikehaas763","html_url":"https://github.com/mikehaas763","followers_url":"https://api.github.com/users/mikehaas763/followers","following_url":"https://api.github.com/users/mikehaas763/following{/other_user}","gists_url":"https://api.github.com/users/mikehaas763/gists{/gist_id}","starred_url":"https://api.github.com/users/mikehaas763/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikehaas763/subscriptions","organizations_url":"https://api.github.com/users/mikehaas763/orgs","repos_url":"https://api.github.com/users/mikehaas763/repos","events_url":"https://api.github.com/users/mikehaas763/events{/privacy}","received_events_url":"https://api.github.com/users/mikehaas763/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-19T13:37:35Z","updated_at":"2015-05-21T13:10:11Z","closed_at":"2015-05-21T10:11:32Z","pull_request":{"url":"https://api.github.com/repos/ManifestWebDesign/angular-gridster/pulls/275","html_url":"https://github.com/ManifestWebDesign/angular-gridster/pull/275","diff_url":"https://github.com/ManifestWebDesign/angular-gridster/pull/275.diff","patch_url":"https://github.com/ManifestWebDesign/angular-gridster/pull/275.patch"},"body":"RequireJS and Browserify became very popular and now ES6 modules are becoming popular through tooling like SystemJS and the System.register module format. It's important to offer good interop with those module loaders and this PR does that by converting the old IIFE module to a UMD style module that adds support for CommonJS and AMD in addition to the existing regular browser support.\r\n\r\nThe reason this is important is so that I can do imports. This is ES6 which I'm using but it can be translated to using AMD or CommonJS modules and the same thing is implied.\r\n```javascript\r\nimport angular from 'angular';\r\nimport AngularGridsterModule from 'angular-gridster';\r\n\r\nangular.module('app', [AngularGridsterModule.name];\r\n```\r\n\r\nAny chance this can be merged in? The Karma tests are passing but the original master branch state I branched from already had the e2e test run broken. Not sure if those tests are not really used or what."},"comment":{"url":"https://api.github.com/repos/ManifestWebDesign/angular-gridster/issues/comments/104272095","html_url":"https://github.com/ManifestWebDesign/angular-gridster/pull/275#issuecomment-104272095","issue_url":"https://api.github.com/repos/ManifestWebDesign/angular-gridster/issues/275","id":104272095,"user":{"login":"mikehaas763","id":2096573,"avatar_url":"https://avatars.githubusercontent.com/u/2096573?v=3","gravatar_id":"","url":"https://api.github.com/users/mikehaas763","html_url":"https://github.com/mikehaas763","followers_url":"https://api.github.com/users/mikehaas763/followers","following_url":"https://api.github.com/users/mikehaas763/following{/other_user}","gists_url":"https://api.github.com/users/mikehaas763/gists{/gist_id}","starred_url":"https://api.github.com/users/mikehaas763/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikehaas763/subscriptions","organizations_url":"https://api.github.com/users/mikehaas763/orgs","repos_url":"https://api.github.com/users/mikehaas763/repos","events_url":"https://api.github.com/users/mikehaas763/events{/privacy}","received_events_url":"https://api.github.com/users/mikehaas763/received_events","type":"User","site_admin":false},"created_at":"2015-05-21T13:10:11Z","updated_at":"2015-05-21T13:10:11Z","body":"@danomatic Thanks. I initially was thinking that no there should be absolutely no backward compatibility issues but I think there may be an edge cases that could affect some people. The edge case I'm about to explain IMO are a result of doing something that you shouldn't be in the first place. Nonetheless I should maybe think of a more elegant way to handle this to avoid bc breaks. I haven't actually tested these edge cases I just thought through them in my head.\r\n\r\nThe same applies to CommonJS environments but I'll explain for AMD. The concern I have is if a project uses AMD but accesses the global angular object directly rather than appropriately shimming in angular as an AMD module. I'm guessing this would mean that the call to `define(['angular'], factory);` would either outright fail because the `['angular']` dependency has not been defined or the angular-gridster module would fail because the factory function it's in has an `angular` argument that would \"hide\" the global angular.\r\n\r\nIn the first case, I'm just not sure how the AMD implementations (such as RequireJS) handle it. My best guess is that they fail and throw an exception because of the missing angular dependency. For CommonJS I know that the require would fail in node land and I assume it would also fail for browserify.\r\n\r\nSorry for not catching this right away. Do you think this is an appropriate time to make a bc break and expect consumers of the lib to register angular as a module in their module system or should I find a way to implement this without causing that break (not sure how yet)?\r\n"}}