Created
April 16, 2013 10:00
-
-
Save civic/5394787 to your computer and use it in GitHub Desktop.
例えば非同期処理のcallback関数などにあえて関数名をつけるのはどうだろう?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//例えば非同期処理のcallback関数などにあえて関数名をつけるのはどうだろう? | |
someAjaxFunction("parmaeter", | |
function 販売価格の取得に成功した時(calculatedSalesPrice){ | |
console.log(calculatedSalesPrice); | |
}, | |
function なんかエラー(e){ | |
console.log(e); | |
} | |
); | |
//変更前 | |
someAjaxFunction("parmaeter", | |
function(calculatedSalesPrice){ | |
console.log(calculatedSalesPrice); | |
}, | |
function(e){ | |
console.log(e); | |
} | |
); | |
//同様にコメントの代わりに関数にして即実行とか | |
(function 三角形を描画(){ | |
gc.draw(....); | |
gc.draw(....); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment