2016-06-07 30 views
0

因此,在此示例中,回調函數語法將在Safari和移動Chrome和Safari上中斷。api示例具有Safari瀏覽器和移動Chrome的不良回調語法

utils.api.cart.getContent(options, (err, response) => { 
    $modalOverlay.hide(); 
    $cartCounter.text(response.data.cart.items.length + " items in your cart"); 
    $modalContent.html(response.content); 
}); 

應的代碼示例使用ES6語法寫成...

utils.api.cart.getContent(options, function(err, response) { 
    $modalOverlay.hide(); 
    $cartCounter.text(response.data.cart.items.length + " items in your cart"); 
    $modalContent.html(response.content); 
}); 

回答

相關問題