How to use the core-js/library/es6/promise.resolve function in core-js

To help you get started, we’ve selected a few core-js 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 tresorit / ZeroKit-Web-SDK / src / users / loginIframe.ts View on Github external
return cbRes.then(() => window.location.assign(reTo), () => window.location.assign(reTo));
      else
        window.location.assign(reTo);
    } else {
      window.location.assign(reTo);
    }

    // We should never get here because of the redirection above
    return new Promise(() => {}); // Intentionally never resolve
  } else {
    if (callback) {
      const cbRes = callback(loginResponse.userId, loginResponse.needsRedirect);
      if (cbRes && cbRes.then)
        return cbRes.then(() => loginResponse.userId);
    }
    return Promise.resolve(loginResponse.userId);
  }
}
github nhn / tui.image-editor / src / js / component / rotation.js View on Github external
setAngle(angle) {
        const oldAngle = this.getCurrentAngle() % 360; // The angle is lower than 2*PI(===360 degrees)

        angle %= 360;

        const canvasImage = this.getCanvasImage();
        const oldImageCenter = canvasImage.getCenterPoint();
        canvasImage.set({angle}).setCoords();
        this.adjustCanvasDimension();
        const newImageCenter = canvasImage.getCenterPoint();
        this._rotateForEachObject(oldImageCenter, newImageCenter, angle - oldAngle);

        return Promise.resolve(angle);
    }
github nhn / tui.image-editor / test / command.spec.js View on Github external
it('can register custom command', done => {
            const testCommand = {
                name: 'testCommand',
                execute() {
                },
                undo() {
                }
            };

            spyOn(testCommand, 'execute').and.returnValue(Promise.resolve('testCommand'));
            spyOn(testCommand, 'undo').and.returnValue(Promise.resolve());

            commandFactory.register(testCommand);

            const command = commandFactory.create('testCommand');
            expect(command).not.toBe(null);

            invoker.execute('testCommand', graphics).then(commandName => {
                expect(commandName).toBe('testCommand');
                expect(testCommand.execute).toHaveBeenCalledWith(graphics);
                done();
            })['catch'](message => {
                fail(message);
                done();
            });
        });
github nhn / tui.image-editor / test / command.spec.js View on Github external
it('can register custom command', done => {
            const testCommand = {
                name: 'testCommand',
                execute() {
                },
                undo() {
                }
            };

            spyOn(testCommand, 'execute').and.returnValue(Promise.resolve('testCommand'));
            spyOn(testCommand, 'undo').and.returnValue(Promise.resolve());

            commandFactory.register(testCommand);

            const command = commandFactory.create('testCommand');
            expect(command).not.toBe(null);

            invoker.execute('testCommand', graphics).then(commandName => {
                expect(commandName).toBe('testCommand');
                expect(testCommand.execute).toHaveBeenCalledWith(graphics);
                done();
            })['catch'](message => {
                fail(message);
                done();
            });
        });
github nhn / tui.image-editor / src / js / command / addShape.js View on Github external
undo(graphics) {
        graphics.remove(this.undoData.object);

        return Promise.resolve();
    }
};
github nhn / tui.image-editor / src / js / command / addIcon.js View on Github external
undo(graphics) {
        graphics.remove(this.undoData.object);

        return Promise.resolve();
    }
};
github nhn / tui.image-editor / src / js / command / resizeCanvasDimension.js View on Github external
undo(graphics) {
        graphics.setCssMaxDimension(this.undoData.size);
        graphics.adjustCanvasDimension();

        return Promise.resolve();
    }
};
github nhn / tui.image-editor / src / js / command / clearObjects.js View on Github external
undo(graphics) {
        graphics.add(this.undoData.objects);

        return Promise.resolve();
    }
};
github nhn / tui.image-editor / src / js / command / addText.js View on Github external
undo(graphics) {
        graphics.remove(this.undoData.object);

        return Promise.resolve();
    }
};
github nhn / tui.image-editor / src / js / command / changeIconColor.js View on Github external
undo(graphics) {
        const iconComp = graphics.getComponent(ICON);
        const {object: icon, color} = this.undoData.object;

        iconComp.setColor(color, icon);

        return Promise.resolve();
    }
};