Revert window.Promise back to native

30 Views Asked by At

I have a JS library (lets call it library 'a') which is an angular app component and is served through a CDN. I also have another library (let call it library 'b') which was written in typescript and transpiled down to es6.

I am loading both these libraries inside of a .Net MVC Knockoutjs application. I am facing an issue, when I load library 'a' it modifies native promises, and library 'b' relies on native promises to perform operations inside it.

If I remove library 'a' from the page and only load library 'b' it works fine.

When I only load library 'b' this is what window.Promise looks like -

enter image description here

When I load library 'a' this is what window.Promise looks like -

enter image description here

And after loading library 'a' if I load library 'b', the Promises inside this library 'b' begins to fail. Seems like all instanceof Promise evaluate to false even if it is a Promise

See below - enter image description here

This is from library 'b'

I am loading these libraries on a user click and add it to DOM using jquery $getScript('', ()=> {})

I am wondering, if there's a way to revert window.Promise back to the native, when I am about to load library 'b'

I am pretty new to Promises, any help is appreciated.

Thanks.

0

There are 0 best solutions below