Created
May 3, 2017 19:45
-
-
Save LayneSmith/5142c459f642f5a4af6bbff0d2591e10 to your computer and use it in GitHub Desktop.
Basic promise structure
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
/////////////////////////////////////////////////// | |
// LOAD FILES FROM SONGS LIST | |
/////////////////////////////////////////////////// | |
let initialFunction = function () { | |
return new Promise((resolve, reject) => { | |
console.log('%cinitialFunction....', "color: purple; font-size: 24px;"); | |
resolve('initialFunction COMPLETE'); | |
}); | |
}; | |
let function1 = function () { | |
return new Promise((resolve, reject) => { | |
console.log('%cfunction1....', "color: purple; font-size: 24px;"); | |
resolve('function1 COMPLETE'); | |
}); | |
}; | |
let function2 = function () { | |
return new Promise((resolve, reject) => { | |
console.log('%cfunction2....', "color: purple; font-size: 24px;"); | |
resolve('function2 COMPLETE'); | |
}); | |
}; | |
let function3 = function () { | |
return new Promise((resolve, reject) => { | |
console.log('%cfunction3....', "color: purple; font-size: 24px;"); | |
resolve('function3 COMPLETE'); | |
}); | |
}; | |
/////////////////////////////////////////////////// | |
// PREPARE AUDIO DECKS FOR DIVs | |
/////////////////////////////////////////////////// | |
$('#loadAudio').on('click', () => { | |
initialFunction() | |
.then(() => function1()) | |
.then(() => function2()) | |
.then(() => function3()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment