How to use the zalgo-promise/src.ZalgoPromise.delay function in zalgo-promise

To help you get started, we’ve selected a few zalgo-promise 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 paypal / paypal-smart-payment-buttons / test / client / native.js View on Github external
}
            });

            let error;

            try {
                await clickButton(FUNDING.PAYPAL);
            } catch (err) {
                error = err;
            }

            if (!error) {
                throw new Error(`Expected button click to trigger an error`);
            }

            await ZalgoPromise.delay(1000);

            gqlMock.done();
            firebaseScripts.done();
            await mockWebSocketServer.done();

            if (!closeMessageSent) {
                throw new Error(`Expected close message to be sent`);
            }
        });
    });
github paypal / paypal-smart-payment-buttons / test / client / prerender.js View on Github external
window.xprops.onClick = mockAsyncProp(expect('onClick', (data, actions) => {
                return ZalgoPromise.delay(50).then(() => actions.reject());
            }));
github krakenjs / zoid / dist / module / component / parent / index.js View on Github external
return win.isClosed().then(function (closed) {
            if (closed) {
                return _this18.userClose();
            }

            return ZalgoPromise.delay(200).then(function () {
                return win.isClosed();
            }).then(function (secondClosed) {
                if (secondClosed) {
                    return _this18.userClose();
                }
            });
        });
    };
github krakenjs / zoid / src / component / parent / index.js View on Github external
return win.isClosed().then(closed => {
            if (closed) {
                return this.userClose();
            }

            return ZalgoPromise.delay(200)
                .then(() => win.isClosed())
                .then(secondClosed => {
                    if (secondClosed) {
                        return this.userClose();
                    }
                });
        });
    }
github paypal / paypal-smart-payment-buttons / src / payment-flows / native.js View on Github external
}).then(valid => {
            if (valid) {
                if (usePopupAppSwitch() && win) {
                    win.location = getNativePopupUrl();
                }
            } else {
                if (usePopupAppSwitch()) {
                    close();
                } else {
                    return ZalgoPromise.delay(500).then(() => {
                        if (didAppSwitch(win)) {
                            return connectNative().close();
                        }
                    }).then(() => {
                        return close();
                    });
                }
            }
        }, err => {
            close();
github paypal / paypal-smart-payment-buttons / src / api / socket.js View on Github external
socketPromise = ZalgoPromise.try(() => {
            if (retryDelay) {
                retryPromise = ZalgoPromise.delay(retryDelay);
                return retryPromise;
            }
        }).then(() => {
            retryPromise = null;
github krakenjs / zoid / src / parent / index.js View on Github external
return win.isClosed().then(closed => {
            if (closed) {
                return this.close();
            }

            return ZalgoPromise.delay(200)
                .then(() => win.isClosed())
                .then(secondClosed => {
                    if (secondClosed) {
                        return this.close();
                    }
                });
        });
    }
github krakenjs / zoid / src / parent / index.js View on Github external
watchForClose(proxyWin : ProxyWindow) : ZalgoPromise {
        let cancelled = false;

        this.clean.register(() => {
            cancelled = true;
        });

        return ZalgoPromise.delay(2000).then(() => {
            return proxyWin.isClosed();
        }).then(isClosed => {
            if (isClosed) {
                this.component.log(`detect_close_child`);
                return this.close();
            } else if (!cancelled) {
                return this.watchForClose(proxyWin);
            }
        });
    }
github paypal / paypal-smart-payment-buttons / src / menu / page.jsx View on Github external
const onBlurHandler = () => {
        setOpaque(false);
        return ZalgoPromise.delay(FADE_TIME).then(() => {
            setVisible(false);
            return ZalgoPromise.all([ onBlur(), hide() ]);
        });
    };