Created
December 1, 2022 16:43
-
-
Save hpyhacking/5678d1ee88f238d5975ddd4573c6579f to your computer and use it in GitHub Desktop.
callback
This file contains hidden or 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
class Geocoding { | |
search(query, callback) { | |
// dosomething and take data | |
// data = 1 | |
// | |
// let data = 1 | |
//return data | |
// | |
jQuery.ajax('a.json', function(data) { | |
callback(data) | |
}) | |
//callback(data) | |
} | |
} | |
// search_ui.js | |
// | |
let callback = function(data) { | |
// do something | |
$('text').text(data.lot) | |
} | |
let callback1 = function(data) { | |
// do something | |
$('text-1').text(data.lot) | |
} | |
let a = new Geocoding() | |
a.search(query, callback) | |
a.search(query, callback1) | |
function a(callback) { | |
console.log('a') | |
callback() | |
} | |
function b(callback) { | |
console.log('b') | |
callback() | |
} | |
function c(callback) { | |
console.log('c') | |
callback() | |
} | |
c(function() { a(b) }) | |
//let x = function() { | |
//a(b) | |
//} | |
//c(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment