Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise.all and Promise.allSettled doesn't work if the promise array has been created in a different frame. #72

Open
rdeangelis83 opened this issue Sep 20, 2021 · 2 comments

Comments

@rdeangelis83
Copy link

Method isInstanceOf (used in each method) doesn't work correctly for arrays created in a different frame.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray

Array.isArray is the better alternative but is not implemented in all browser so I would suggest following:

        function isArray(obj) {
            if (Array.isArray && Array.isArray(obj)) {
                return true;
            }

            if (isInstanceOf(obj, Arr)) {
                return true;
            }
            
            if (Object.prototype.toString.call(obj) === "[object Array]") {
                return true;
            }

            return false;
        }
}
@ysmood
Copy link
Owner

ysmood commented Sep 22, 2021

Could you help to make a PR for it?

@rdeangelis83
Copy link
Author

Of course. I will make a PR this evening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants