0

I am reversing a little javascript library for my private use. This library is using promises to pass data around between different functions. This way, you cannot backtrack the function that is responsible for "creating" the data. Its hidden behind the promise object and there is no information about where the promise is set up to look it up (in the object). So, now I am stuck with around 100 promises that are created in the code file. What they do is something similar to this:

They create promises somewhere in the code.

let promise1 = new Promise(function(success, error) {
//   doing some magic
success(data)
});

they store all these promises in some weird data structure.

let AllPromises = S.add(promise1)

Then, the function i can backtrack using breakpoints that uses the interesting data does the following:

promise1=S.retrieve()
promise1.then(function(data) {
   //do something with the data
})

The devs are using promises to complicate the code flow. I cannot access the function that is generating the data from the promise object?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.