{"action":"created","issue":{"url":"https://api.github.com/repos/invisible-college/statebus/issues/14","labels_url":"https://api.github.com/repos/invisible-college/statebus/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/invisible-college/statebus/issues/14/comments","events_url":"https://api.github.com/repos/invisible-college/statebus/issues/14/events","html_url":"https://github.com/invisible-college/statebus/pull/14","id":130099356,"number":14,"title":"ability to override default js locations; new default locations for coffeescript compiler and statebus","user":{"login":"tkriplean","id":707039,"avatar_url":"https://avatars.githubusercontent.com/u/707039?v=3","gravatar_id":"","url":"https://api.github.com/users/tkriplean","html_url":"https://github.com/tkriplean","followers_url":"https://api.github.com/users/tkriplean/followers","following_url":"https://api.github.com/users/tkriplean/following{/other_user}","gists_url":"https://api.github.com/users/tkriplean/gists{/gist_id}","starred_url":"https://api.github.com/users/tkriplean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkriplean/subscriptions","organizations_url":"https://api.github.com/users/tkriplean/orgs","repos_url":"https://api.github.com/users/tkriplean/repos","events_url":"https://api.github.com/users/tkriplean/events{/privacy}","received_events_url":"https://api.github.com/users/tkriplean/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-01-31T08:05:09Z","updated_at":"2016-01-31T22:04:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/invisible-college/statebus/pulls/14","html_url":"https://github.com/invisible-college/statebus/pull/14","diff_url":"https://github.com/invisible-college/statebus/pull/14.diff","patch_url":"https://github.com/invisible-college/statebus/pull/14.patch"},"body":"There are a few interconnected changes for loading external javascripts in this pull request:\r\n\r\n1) A statebus application can override the default location of any required library using window.scripts_to_load. One application of this functionality is to set the version of statebus.js that is loaded to a local file that you’re developing on. This aids statebus development when you’re making changes to statebus in concert with an application you’re developing. This also facilitates offline development because you can download required scripts ahead of time and point to them in your app.\r\n\r\n2) The application can specify additional external scripts to load. For example, d3. This is pretty easy for an application to handle itself, but I’ve had a couple people already ask me how they could load external scripts to a statebus application. Because statebus_client already loads a number of javascript, I figured it would be nice to just unify the ability to override default javascript location with the ability to specify additional application-specific javascripts to load in window.scripts_to_load. The app developer then doesn't have to copy/paste the code to write some required scripts into the document. \r\n\r\n3) I changed the default location of statebus.js from a random dropbox link to https://rawgit.com/invisible-college/statebus/master/statebus.js. This will by default serve the statebus.js file that is in our github. When we push changes to github, this file will serve the new version within a couple minutes. rawgit only caches for a short period.\r\n\r\n4) I updated coffee-script compiler from 1.8 to 1.10 (the file is actually 20% smaller). And I put it on our considerit cloudfront cdn. So instead of serving from dropbox, it is serving from there. Karthik will be happy ;-)\r\n\r\n\r\nHere is an example application configuration that uses some of this functionality: \r\n\r\n```\r\n<snip>\r\n\r\n<script>\r\n  // The statebus server we will connect to. Read by statebus_client.\r\n  statebus_server = 'http://localhost:9375'\r\n\r\n  // External scripts that statebus_client will load. You can also \r\n  // override default locations for scripts here. \r\n  scripts_to_load = {\r\n    d3: 'd3.quadtree.js',\r\n    md5: 'md5.js',\r\n  }\r\n  // I'm gonna use a local version of statebus.js I'm deving on\r\n  scripts_to_load.statebus = 'considerit-data-importer/node_modules/statebus/statebus.js'\r\n  statebus_client = \"considerit-data-importer/node_modules/statebus/client.js\"\r\n  \r\n  document.write( '<script src=\"' + statebus_client + '\" charset=\"utf-8\"><\\/script>')\r\n\r\n</script>\r\n\r\n```\r\nNote that statebus applications should probably stop using the dropbox statebus_client.js link and use https://rawgit.com/invisible-college/statebus/master/client.js instead. "},"comment":{"url":"https://api.github.com/repos/invisible-college/statebus/issues/comments/177631298","html_url":"https://github.com/invisible-college/statebus/pull/14#issuecomment-177631298","issue_url":"https://api.github.com/repos/invisible-college/statebus/issues/14","id":177631298,"user":{"login":"tkriplean","id":707039,"avatar_url":"https://avatars.githubusercontent.com/u/707039?v=3","gravatar_id":"","url":"https://api.github.com/users/tkriplean","html_url":"https://github.com/tkriplean","followers_url":"https://api.github.com/users/tkriplean/followers","following_url":"https://api.github.com/users/tkriplean/following{/other_user}","gists_url":"https://api.github.com/users/tkriplean/gists{/gist_id}","starred_url":"https://api.github.com/users/tkriplean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkriplean/subscriptions","organizations_url":"https://api.github.com/users/tkriplean/orgs","repos_url":"https://api.github.com/users/tkriplean/repos","events_url":"https://api.github.com/users/tkriplean/events{/privacy}","received_events_url":"https://api.github.com/users/tkriplean/received_events","type":"User","site_admin":false},"created_at":"2016-01-31T22:04:41Z","updated_at":"2016-01-31T22:04:41Z","body":"> If you add extra files to git like a demo app, we should also put it into a .npmignore (or the equivalent) so that it doesn't get pushed into the npm package, now that they are the same thing.\r\n\r\nI was thinking it might actually be better to make the sample app a separate repo that people could clone and get working. Thoughts? "}}