289
edits
(reply re: async methods) |
(reply re: listener structures) |
||
| Line 160: | Line 160: | ||
} | } | ||
</pre> | </pre> | ||
'''jminta's reply:''' This is an interesting approach, and especially if this is the way other js frameworks are doing things, we should consider it. I should point out though that you can make your first approach look *almost* identical to the second, like so: | |||
<pre> | |||
function onSearchClicked(){ | |||
var msgList = document.getElementByID('message-list'); | |||
var deferred = {}; | |||
Application.search('thunderbird', 'steel', deferred); | |||
deferred.onGetResult = onNewMessage; | |||
deferred.onError = onSearchError; | |||
} | |||
</pre> | |||
A few other points: | |||
*Your point about a lack of status results/error handlers is crucial. I definitely think we should add an onError() method to the listener. | |||
*Your second approach allows arguments to be appended to listener calls. Unfortunately, the strict nature of IDL would make this difficult to implement, and we're stuck with those restrictions. (It could be done as an array of arguments, but that's getting weird.) | |||
*The notion of appending listener methods *after* a request has been dispatched strikes me as odd. I've written async methods that actually call their listeners *before* the dispatch call returns. Is this normal programming in other frameworks? | |||
=== steelIApplication === | === steelIApplication === | ||
edits