How to use the core-js/library/es6/promise.reject 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 nhn / tui.image-editor / src / js / component / flip.js View on Github external
set(newSetting) {
        const setting = this.getCurrentSetting();
        const isChangingFlipX = (setting.flipX !== newSetting.flipX);
        const isChangingFlipY = (setting.flipY !== newSetting.flipY);

        if (!isChangingFlipX && !isChangingFlipY) {
            return Promise.reject(rejectMessages.flip);
        }

        snippet.extend(setting, newSetting);
        this.setImageProperties(setting, true);
        this._invertAngle(isChangingFlipX, isChangingFlipY);
        this._flipObjects(isChangingFlipX, isChangingFlipY);

        return Promise.resolve({
            flipX: setting.flipX,
            flipY: setting.flipY,
            angle: this.getCanvasImage().angle
        });
    }
github nhn / tui.image-editor / src / js / imageEditor.js View on Github external
loadImageFromURL(url, imageName) {
        if (!imageName || !url) {
            return Promise.reject(rejectMessages.invalidParameters);
        }

        return this.execute(commands.LOAD_IMAGE, imageName, url);
    }
github nhn / tui.image-editor / src / js / command / changeTextStyle.js View on Github external
execute(graphics, id, styles) {
        const textComp = graphics.getComponent(TEXT);
        const targetObj = graphics.getObject(id);

        if (!targetObj) {
            return Promise.reject(rejectMessages.noObject);
        }

        this.undoData.object = targetObj;
        this.undoData.styles = {};
        snippet.forEachOwnProperties(styles, (value, key) => {
            this.undoData.styles[key] = targetObj[key];
        });

        return textComp.setStyle(targetObj, styles);
    },
    /**
github nhn / tui.image-editor / src / js / invoker.js View on Github external
if (command && this._isLocked) {
            this.pushRedoStack(command, true);
            command = null;
        }
        if (command) {
            if (this.isEmptyRedoStack()) {
                this._fireRedoStackChanged();
            }
            promise = this._invokeExecution(command);
        } else {
            message = rejectMessages.redo;
            if (this._isLocked) {
                message = `${message} Because ${rejectMessages.isLock}`;
            }
            promise = Promise.reject(message);
        }

        return promise;
    }
github nhn / tui.image-editor / src / js / invoker.js View on Github external
if (command && this._isLocked) {
            this.pushUndoStack(command, true);
            command = null;
        }
        if (command) {
            if (this.isEmptyUndoStack()) {
                this._fireUndoStackChanged();
            }
            promise = this._invokeUndo(command);
        } else {
            message = rejectMessages.undo;
            if (this._isLocked) {
                message = `${message} Because ${rejectMessages.isLock}`;
            }
            promise = Promise.reject(message);
        }

        return promise;
    }
github nhn / tui.image-editor / src / js / invoker.js View on Github external
execute(...args) {
        if (this._isLocked) {
            return Promise.reject(rejectMessages.isLock);
        }

        let [command] = args;
        if (isString(command)) {
            command = commandFactory.create(...args);
        }

        return this._invokeExecution(command)
            .then(value => {
                this.clearRedoStack();

                return value;
            });
    }
github nhn / tui.image-editor / src / js / command / changeShape.js View on Github external
execute(graphics, id, options) {
        const shapeComp = graphics.getComponent(SHAPE);
        const targetObj = graphics.getObject(id);

        if (!targetObj) {
            return Promise.reject(rejectMessages.noObject);
        }

        this.undoData.object = targetObj;
        this.undoData.options = {};
        snippet.forEachOwnProperties(options, (value, key) => {
            this.undoData.options[key] = targetObj[key];
        });

        return shapeComp.change(targetObj, options);
    },
    /**
github nhn / tui.image-editor / src / js / component / imageLoader.js View on Github external
_setBackgroundImage(img) {
        if (!img) {
            return Promise.reject(rejectMessages.loadImage);
        }

        return new Promise((resolve, reject) => {
            const canvas = this.getCanvas();

            canvas.setBackgroundImage(img, () => {
                const oImage = canvas.backgroundImage;

                if (oImage && oImage.getElement()) {
                    resolve(oImage);
                } else {
                    reject(rejectMessages.loadingImageFailed);
                }
            }, imageOption);
        });
    }