How to use the pinkie 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 / cookie / window-sync.ts View on Github external
private _sendSyncMessage (win: Window, cmd: string, cookies): Promise {
        const id     = this._messageIdGenerator.increment();
        let attempts = 0;

        return new Promise((resolve: Function) => {
            let timeoutId: number | null = null;

            const resolveWrapper = () => {
                nativeMethods.clearTimeout.call(this._win, timeoutId as number);
                this._resolversMap.delete(id);
                resolve();
            };

            const sendMsg = () => {
                // NOTE: The window was removed if the parent property is null.
                if (attempts++ < SYNC_MESSAGE_ATTEMPT_COUNT || !win.parent) {
                    this._messageSandbox.sendServiceMsg({ id, cmd, cookies }, win);
                    timeoutId = nativeMethods.setTimeout.call(this._win, sendMsg, SYNC_MESSAGE_TIMEOUT * attempts);
                }
                else
                    resolveWrapper();
github DevExpress / testcafe-hammerhead / src / client / transport.ts View on Github external
asyncServiceMsg (msg): Promise {
        return new Promise((resolve, reject) => {
            this._performRequest(msg, (err, data) => {
                if (!err)
                    resolve(data);
                else if (msg.allowRejecting)
                    reject(err);
            });
        });
    }
github DevExpress / testcafe-browser-provider-electron / src / ipc.js View on Github external
_startIpcServer () {
        return new Promise(resolve => {
            this.ipc.serve(() => resolve(this.ipc.server));

            this.ipc.server.start();
        });
    }
github DevExpress / testcafe / src / client / browser / index.js View on Github external
export function sendXHR (url, createXHR, { method = 'GET', data = null, parseResponse = true } = {}) {
    return new Promise((resolve, reject) => {
        const xhr = createXHR();

        xhr.open(method, url, true);

        if (isRetryingTestPagesEnabled()) {
            xhr.setRequestHeader(UNSTABLE_NETWORK_MODE_HEADER, 'true');
            xhr.setRequestHeader('accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');
        }

        xhr.onreadystatechange = () => {
            if (xhr.readyState === 4) {
                if (xhr.status === 200) {
                    let responseText = xhr.responseText || '';

                    if (responseText && parseResponse)
                        responseText = JSON.parse(xhr.responseText); //eslint-disable-line no-restricted-globals
github DevExpress / testcafe-browser-provider-electron / src / ipc.js View on Github external
_connectToIpcServer () {
        return new Promise(resolve => {
            this.ipc.connectTo(this.serverId, resolve);
        });
    }
github DevExpress / testcafe-browser-provider-electron / src / ipc.js View on Github external
_getIpcSocket () {
        return new Promise(resolve => this.server.on('connect', resolve));
    }
github DevExpress / testcafe / src / utils / re-executable-promise.js View on Github external
_ensureExecuting () {
        if (!this._taskPromise)
            this._taskPromise = new Promise(this._fn);
    }
github DevExpress / testcafe-browser-provider-electron / src / ipc.js View on Github external
_getInjectingStatusPromise () {
        return new Promise(resolve => {
            this.server.on(MESSAGES.getInjectingStatus, data => {
                this.server.off(MESSAGES.getInjectingStatus, '*');
                resolve(data);
            });
        });
    }

pinkie

Itty bitty little widdle twinkie pinkie ES2015 Promise implementation

MIT
Latest version published 8 years ago

Package Health Score

67 / 100
Full package analysis