{"action":"created","issue":{"url":"https://api.github.com/repos/palantir/plottable/issues/2604","labels_url":"https://api.github.com/repos/palantir/plottable/issues/2604/labels{/name}","comments_url":"https://api.github.com/repos/palantir/plottable/issues/2604/comments","events_url":"https://api.github.com/repos/palantir/plottable/issues/2604/events","html_url":"https://github.com/palantir/plottable/issues/2604","id":100651487,"number":2604,"title":"[Architecture] Switch to a more callback-oriented architecture","user":{"login":"aicioara","id":3248682,"avatar_url":"https://avatars.githubusercontent.com/u/3248682?v=3","gravatar_id":"","url":"https://api.github.com/users/aicioara","html_url":"https://github.com/aicioara","followers_url":"https://api.github.com/users/aicioara/followers","following_url":"https://api.github.com/users/aicioara/following{/other_user}","gists_url":"https://api.github.com/users/aicioara/gists{/gist_id}","starred_url":"https://api.github.com/users/aicioara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aicioara/subscriptions","organizations_url":"https://api.github.com/users/aicioara/orgs","repos_url":"https://api.github.com/users/aicioara/repos","events_url":"https://api.github.com/users/aicioara/events{/privacy}","received_events_url":"https://api.github.com/users/aicioara/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-12T22:45:58Z","updated_at":"2015-08-12T23:20:46Z","closed_at":null,"body":"I am not sure if this is a good idea, but it is worth a thought. I see myself writing this sort of code a lot\r\n\r\n```typescript\r\nif (this.x() && this.x().scale && this.y() && this.y().scale) {\r\n  // do something\r\n}\r\n```\r\n\r\nNot only that but I will still want to do the `// do something`, once the scales are available, so I end up writing it into the `.x()` or `.y()`, which is 1. not pretty 2. opens room for a lot of edge case errors (say I forgot to add the code in the `.x()` 3. Code duplication (the code in the projector is also the same code I write inside the if (exemplified above)).\r\n\r\nSuggestion is to move to a callback based architecture. We need to figure out what are the best points to add to the Component API, but it would look like\r\n\r\n```typescript\r\nComponent.onRenderFinish()\r\nComponent.offRenderFinish()\r\n\r\nComponent.onProjectorsReady()\r\nComponent.offProjectorsReady()\r\n\r\nComponent.onAnchor() // exists already\r\nComponent.offAnchor() // exists already\r\n```\r\n\r\nComments? "},"comment":{"url":"https://api.github.com/repos/palantir/plottable/issues/comments/130475194","html_url":"https://github.com/palantir/plottable/issues/2604#issuecomment-130475194","issue_url":"https://api.github.com/repos/palantir/plottable/issues/2604","id":130475194,"user":{"login":"aicioara","id":3248682,"avatar_url":"https://avatars.githubusercontent.com/u/3248682?v=3","gravatar_id":"","url":"https://api.github.com/users/aicioara","html_url":"https://github.com/aicioara","followers_url":"https://api.github.com/users/aicioara/followers","following_url":"https://api.github.com/users/aicioara/following{/other_user}","gists_url":"https://api.github.com/users/aicioara/gists{/gist_id}","starred_url":"https://api.github.com/users/aicioara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aicioara/subscriptions","organizations_url":"https://api.github.com/users/aicioara/orgs","repos_url":"https://api.github.com/users/aicioara/repos","events_url":"https://api.github.com/users/aicioara/events{/privacy}","received_events_url":"https://api.github.com/users/aicioara/received_events","type":"User","site_admin":false},"created_at":"2015-08-12T23:20:46Z","updated_at":"2015-08-12T23:20:46Z","body":"@bluong @jtlan @ztsai RFC"}}