How to use the pinkie.reject function in pinkie

To help you get started, we’ve selected a few pinkie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DevExpress / testcafe-hammerhead / src / client / sandbox / node / window.ts View on Github external
window.navigator.serviceWorker.register = (...args) => {
                const url = args[0];

                if (typeof url === 'string') {
                    if (WindowSandbox._isSecureOrigin(url)) {
                        // NOTE: We cannot create an instance of the DOMException in the Android 6.0 and in the Edge 17 browsers.
                        // The 'TypeError: Illegal constructor' error is raised if we try to call the constructor.
                        return Promise.reject(isAndroid || isMSEdge && browserVersion >= 17
                            ? new Error('Only secure origins are allowed.')
                            : new DOMException('Only secure origins are allowed.', 'SecurityError'));
                    }

                    args[0] = getProxyUrl(url, { resourceType: stringifyResourceType({ isScript: true }) });
                }

                if (args[1] && typeof args[1].scope === 'string') {
                    args[1].scope = getProxyUrl(args[1].scope, {
                        resourceType: stringifyResourceType({ isScript: true })
                    });
                }

                return nativeMethods.registerServiceWorker.apply(window.navigator.serviceWorker, args);
            };
        }
github DevExpress / testcafe-hammerhead / src / client / transport.ts View on Github external
.catch(err => {
                if (isRejectingAllowed)
                    return Promise.reject(err);

                return createUnresolvablePromise();
            });
    }

pinkie

Itty bitty little widdle twinkie pinkie ES2015 Promise implementation

MIT
Latest version published 9 years ago

Package Health Score

67 / 100
Full package analysis