{"action":"closed","issue":{"url":"https://api.github.com/repos/ember-cli/ember-cli/issues/5242","labels_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/5242/labels{/name}","comments_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/5242/comments","events_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/5242/events","html_url":"https://github.com/ember-cli/ember-cli/issues/5242","id":123361801,"number":5242,"title":"Refactor `app-boot`?","user":{"login":"nathanhammond","id":20542,"avatar_url":"https://avatars.githubusercontent.com/u/20542?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanhammond","html_url":"https://github.com/nathanhammond","followers_url":"https://api.github.com/users/nathanhammond/followers","following_url":"https://api.github.com/users/nathanhammond/following{/other_user}","gists_url":"https://api.github.com/users/nathanhammond/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanhammond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanhammond/subscriptions","organizations_url":"https://api.github.com/users/nathanhammond/orgs","repos_url":"https://api.github.com/users/nathanhammond/repos","events_url":"https://api.github.com/users/nathanhammond/events{/privacy}","received_events_url":"https://api.github.com/users/nathanhammond/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-21T21:24:29Z","updated_at":"2015-12-22T03:56:22Z","closed_at":"2015-12-22T03:56:22Z","body":"I'd like to propose rethinking the `app-boot` hook. Treating it as an appended section of imperative code inside of `app.js` makes it difficult to reason about in a modules-only world. We only have a few occurrences of this in our extended codebases (I audited every occurrence on GitHub), which imply that we can reduce the API surface area and accomplish the same underlying goal of triggering the initial `require` that unravels everything.\r\n\r\n## Use cases:\r\n* [ember-cli](https://github.com/ember-cli/ember-cli/blob/a2a9a886e146ce7bdfbdd5338542538ea7b38d14/lib/broccoli/ember-app.js#L1600) - Generates the initial require.\r\n* [ember-cli-delay-app-boot](https://github.com/rwjblue/ember-cli-delay-app-boot/blob/master/index.js#L31) - Throws a timeout around the initial require and includes some copypasta from above.\r\n* [ember-cli-fastboot](https://github.com/tildeio/ember-cli-fastboot/blob/2058dd1ebf08be818851d1e65651db49cdd0e69f/index.js#L73) - This adds a new specially-named module and doesn't call `require`. Instead, it itself becomes the module which must be required to boot the app.\r\n- In the future (read: I'm already encountering this) a Service Worker may wish to tell the application when it should boot or bind that functionality onto a promise chain. My current approach is to delay responding to the app-boot request and maintain that promise chain inside of the service worker.\r\n\r\n## Analysis & Proposal\r\nIt seems to me that the primary use case for `app-boot` is to tweak and modify how the initial `require` is called. None of these above use cases are dramatically different. I'd propose that we adopt the behavior of `fastboot` generically, creating a magic module that you can `require` and use to unravel the application. It covers all existing use cases, reduces copypasta, can move us toward reduced API surface area, and makes the `app-boot` hook much simpler: `require('ember-app')()`."}}