Last active
July 30, 2017 06:05
-
-
Save S0ngyuLi/87b64d24cf61506674c2748979291c0c to your computer and use it in GitHub Desktop.
A Simple Tutorial on Callbacks
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
/* | |
Example 1 | |
*/ | |
func OkName(param1, param2, newStr, callback) { | |
callback(newStr) | |
} | |
OkName(1,2,"newStr", collectNewStr(param) { | |
store(param) | |
}) | |
/* | |
Example 2 | |
*/ | |
func OkName(param1, param2, newStr) { | |
store(newStr) | |
} | |
func store(param) { | |
db.insert(param) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment