Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Team {
- constructor() {
- }
- function getTeamInfo() {
- this.teamPromise = new Promise({
- // Load the team meta data in here
- // Then resoolve the promise
- })
- }
- }
- class Match {
- constructor([arrayOfTeams]) {
- var promiseArray = []
- for team in arrayOfTeams{
- promiseArray.push(team.teamPromise);
- }
- Promise.all(promiseArray).({
- this.runMatch()
- })
- }
- function runMatch() {
- // This is only called when we have resolved all the promises that ONLY THIS MATCH is dependent on
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement