Skip to content

Instantly share code, notes, and snippets.

@LayneSmith
Created May 3, 2017 19:45
Show Gist options
  • Save LayneSmith/5142c459f642f5a4af6bbff0d2591e10 to your computer and use it in GitHub Desktop.
Save LayneSmith/5142c459f642f5a4af6bbff0d2591e10 to your computer and use it in GitHub Desktop.
Basic promise structure
///////////////////////////////////////////////////
// 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