javascript - If statement with callback design pattern in coffeescript -
i in coffeescript
data = [default, data] if has_some_data (err, data)-> #has data hits db , callback data = data.get_some_data() process_data()
i process data called when after if statement has executed. there pattern in coffeescript?
i'm not super-sure i'm answering question, if question "how might write coffeescript accomplishes goal?" then...
what using callback , errback so:
data = {...} callback = (data) -> process_data(data) if data errback = (err) -> console.log(err) has_some_data(args, callback, errback)
otherwise, clarify constraints here can answer question? ;)
Comments
Post a Comment