constructor(handler) {
            this._error = false;
            this.__value = undefined;

            try {
                // Make sure to unwrap all nested promises!
                handler(
                    (value) => {
                        while (value instanceof $.Promise) {
                            value = value._value;
                        }
                        this._value = value;
                    },
                    (error) => {
                        while (error instanceof $.Promise) {
                            error = error._value;
                        }
                        this._value = error;
                        this._error = true;
                    }
                );
            } catch (e) {
                this._value = e;
                this._error = true;
            }
        }
Promise proxy in OpenSeadragon, enables $.supportsAsync feature.
This proxy is also necessary because OperaMini does not implement Promises (checks fail).
@type {PromiseConstructor}