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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -