Guest User

Untitled

a guest
Sep 6th, 2015
125
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var getAllTrackIDs = new Promise(function(resolve, reject) {
  2.     var trackIDs = [];
  3.     /* Code to get trackIDs from HTML elements and add to array */
  4.     if(trackIDs != 0) {
  5.         resolve(trackIDs);
  6.     }
  7.     else {
  8.         reject(Error("No trackIDs found"));
  9.     }
  10. });
  11.  
  12. var generateTracks = new Promise(function(resolve, reject) {
  13.     var tracks = [];
  14.     /* Code to generate tracks from TrackIDs and add to array */
  15.     if(tracks != 0) {
  16.         resolve(tracks);
  17.     }
  18.     else {
  19.         reject(Error("Unable to generate tracks");
  20.     }
  21. });
  22.  
  23. getAllTrackIDs.then(generateTracks, function(message) {
  24.     console.error(response);
  25. }).then(function(response) {
  26.     console.log("Done.");
  27. }, function(response) {
  28.     console.error(response);
  29. });
RAW Paste Data