{"action":"created","issue":{"url":"https://api.github.com/repos/neveldo/jQuery-Mapael/issues/179","labels_url":"https://api.github.com/repos/neveldo/jQuery-Mapael/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/neveldo/jQuery-Mapael/issues/179/comments","events_url":"https://api.github.com/repos/neveldo/jQuery-Mapael/issues/179/events","html_url":"https://github.com/neveldo/jQuery-Mapael/issues/179","id":123792343,"number":179,"title":"Questions on callbacks","user":{"login":"Indigo744","id":7137528,"avatar_url":"https://avatars.githubusercontent.com/u/7137528?v=3","gravatar_id":"","url":"https://api.github.com/users/Indigo744","html_url":"https://github.com/Indigo744","followers_url":"https://api.github.com/users/Indigo744/followers","following_url":"https://api.github.com/users/Indigo744/following{/other_user}","gists_url":"https://api.github.com/users/Indigo744/gists{/gist_id}","starred_url":"https://api.github.com/users/Indigo744/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Indigo744/subscriptions","organizations_url":"https://api.github.com/users/Indigo744/orgs","repos_url":"https://api.github.com/users/Indigo744/repos","events_url":"https://api.github.com/users/Indigo744/events{/privacy}","received_events_url":"https://api.github.com/users/Indigo744/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-24T11:10:32Z","updated_at":"2015-12-24T11:11:41Z","closed_at":null,"body":"Hey,\r\n\r\nI was wondering regarding some callbacks we provide: `afterInit`, `afterUpdate`, `afterShowRange`\r\nWhat is the purpose of using an \"after\" callback, instead of simply writing a function after the call? Since JS is sequential, this will work the same.\r\n\r\nI can understand the need for `afterInit` and `afterUpdate`, they provide useful parameters (paper, areas...), even though these parameters are accessible through the Mapael object.\r\n\r\nIn any way, `afterShowRange` is useless in this current state.\r\n\r\nI was thinking, maybe the callbacks should fire only when all animations (if there are animation of course) are finished? That way, the callback will have a more useful purpose.\r\n\r\nRight now, the user doesn't have any information regarding when the animation are done. If a user wants to do something else, it would have to use a `setTimeout()` in order to wait for any animation to finish.\r\n\r\nActually, I was also thinking that any trigger function could return a promise (See the [deferred](https://api.jquery.com/category/deferred-object/) object). That way, the user could write:\r\n```javascript\r\n$(\".mapael\").trigger(\"update\", opt).done(function(){\r\n    // ... special processing executed only after all animations are done\r\n});\r\n```\r\n\r\nWhat is your opinion on this? \r\n"},"comment":{"url":"https://api.github.com/repos/neveldo/jQuery-Mapael/issues/comments/167094477","html_url":"https://github.com/neveldo/jQuery-Mapael/issues/179#issuecomment-167094477","issue_url":"https://api.github.com/repos/neveldo/jQuery-Mapael/issues/179","id":167094477,"user":{"login":"Indigo744","id":7137528,"avatar_url":"https://avatars.githubusercontent.com/u/7137528?v=3","gravatar_id":"","url":"https://api.github.com/users/Indigo744","html_url":"https://github.com/Indigo744","followers_url":"https://api.github.com/users/Indigo744/followers","following_url":"https://api.github.com/users/Indigo744/following{/other_user}","gists_url":"https://api.github.com/users/Indigo744/gists{/gist_id}","starred_url":"https://api.github.com/users/Indigo744/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Indigo744/subscriptions","organizations_url":"https://api.github.com/users/Indigo744/orgs","repos_url":"https://api.github.com/users/Indigo744/repos","events_url":"https://api.github.com/users/Indigo744/events{/privacy}","received_events_url":"https://api.github.com/users/Indigo744/received_events","type":"User","site_admin":false},"created_at":"2015-12-24T11:11:41Z","updated_at":"2015-12-24T11:11:41Z","body":"Also, the Zoom trigger could use an `afterZoom` callback fired only when the zoom is complete."}}