javascript - LiveScript - How do I use the backcall operator when there are multiple callbacks? -


for example:

$.get('/path/to/api').then(   function(data) {     alert( "$.get succeeded" );   }, function(error) {     alert( "$.get failed!" );   } ); 

is possible apply backcall operator on both callbacks?

you can use 1 function backcall, can use backcall, , supply other function (note use of _ placeholder denote backcall function should go in arguments) - eg.

data <- $.get '/path/to/api' .then _, -> alert "$.get failed!" alert "$.get succeeded" 

compiles to:

$.get('/path/to/api').then(function(data){   return alert("$.get succeeded"); }, function(){   return alert("$.get failed!"); }); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -