Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- generateDataPoints: function (iterable, source, arg) {
- let pairs = []
- let prevTime = 0
- for (let index in iterable) {
- let event = iterable[index]
- getTime(event.valueOf()).then(function (time) {
- query(source[arg], event.valueOf()).then(function(val) {
- if (time !== prevTime) {
- prevTime = time
- pairs.push([time, val])
- console.log(pairs) // This works as expected but only happens after the program returns
- } else {
- Promise.resolve()
- }
- })
- })
- }
- return Promise.resolve(pairs)
- }
Add Comment
Please, Sign In to add comment