{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/rfcs/issues/174","repository_url":"https://api.github.com/repos/emberjs/rfcs","labels_url":"https://api.github.com/repos/emberjs/rfcs/issues/174/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/rfcs/issues/174/comments","events_url":"https://api.github.com/repos/emberjs/rfcs/issues/174/events","html_url":"https://github.com/emberjs/rfcs/issues/174","id":185252305,"number":174,"title":"Deprecate the usage of Ember.on for Component's lifecycle events.","user":{"login":"givanse","id":431270,"avatar_url":"https://avatars.githubusercontent.com/u/431270?v=3","gravatar_id":"","url":"https://api.github.com/users/givanse","html_url":"https://github.com/givanse","followers_url":"https://api.github.com/users/givanse/followers","following_url":"https://api.github.com/users/givanse/following{/other_user}","gists_url":"https://api.github.com/users/givanse/gists{/gist_id}","starred_url":"https://api.github.com/users/givanse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/givanse/subscriptions","organizations_url":"https://api.github.com/users/givanse/orgs","repos_url":"https://api.github.com/users/givanse/repos","events_url":"https://api.github.com/users/givanse/events{/privacy}","received_events_url":"https://api.github.com/users/givanse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-25T22:36:36Z","updated_at":"2016-10-26T01:02:46Z","closed_at":null,"body":"### Request\r\n\r\nDeprecate this:\r\n\r\n```\r\nEmber.Component.extend({\r\n  someRandomName: Ember.on('didInsertElement', function() {\r\n  })\r\n});\r\n```\r\n\r\nIn favor of:\r\n\r\n```\r\nEmber.Component.extend({\r\n  didInsertElement: function() {\r\n    this._super(...arguments);\r\n  }\r\n});\r\n```\r\n\r\n### Reasoning\r\n\r\n```\r\nEmber.Component.extend({\r\n  doA: Ember.on('willInsertElement', function() { },\r\n  doB: Ember.on('willInsertElement', function() { }\r\n})\r\n```\r\n\r\nThe order in which `doA` and `doB` happens is unknown. This code might be the result of a bug refactoring. Or, a developer new to the code base not noticing that the event is being observed already. Subtle bugs can be easily introduced.\r\n\r\nIt is also easier to read and understand the behavior of a component if there is a single place where all the event dependent code is executed. Tracking down all the different pieces of code that are executed at different moments in the lifecycle is cumbersome and can be easily avoided by using overrides.\r\n\r\nOne argument that might come up against overrides is:\r\n\r\n> what if people forgets to call super? that can introduce bugs too!\r\n\r\nIt is easier to know that you **always** have to have that call inside the hook, there is determinism. Whereas keeping track of all the `Ember.on`s that might be cohabiting an object is not straightforward. When reading the code, you have to keep a mental map of all the pieces that might be executed by hook; the cognitive load is high."},"comment":{"url":"https://api.github.com/repos/emberjs/rfcs/issues/comments/256222001","html_url":"https://github.com/emberjs/rfcs/issues/174#issuecomment-256222001","issue_url":"https://api.github.com/repos/emberjs/rfcs/issues/174","id":256222001,"user":{"login":"mmun","id":1151810,"avatar_url":"https://avatars.githubusercontent.com/u/1151810?v=3","gravatar_id":"","url":"https://api.github.com/users/mmun","html_url":"https://github.com/mmun","followers_url":"https://api.github.com/users/mmun/followers","following_url":"https://api.github.com/users/mmun/following{/other_user}","gists_url":"https://api.github.com/users/mmun/gists{/gist_id}","starred_url":"https://api.github.com/users/mmun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmun/subscriptions","organizations_url":"https://api.github.com/users/mmun/orgs","repos_url":"https://api.github.com/users/mmun/repos","events_url":"https://api.github.com/users/mmun/events{/privacy}","received_events_url":"https://api.github.com/users/mmun/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T01:02:46Z","updated_at":"2016-10-26T01:02:46Z","body":"Another point against the `Ember.on` style is that you are forced to choose a key name (`doA`, doB`) for each of the event handlers."}}
{"actor":{"display_login":"mmun"}}