Exemplo n.º 1
0
        internal Sailor(Promise promise, AbortablePromise abortablePromise)
        {
            this.promise          = promise;
            this.abortablePromise = abortablePromise;
            this.abortablePromise.AbortRequested += PromiseRequestedAbort;
            SynchronizationContext synchronizationContext = SynchronizationContext.Current;

            if (synchronizationContext != null)
            {
                promise.SynchronizationContext = synchronizationContext;
                this.abortablePromise.SynchronizationContext = synchronizationContext;
            }
        }
Exemplo n.º 2
0
        public virtual IAbortablePromise Notify(Action <object> onNotify)
        {
            if (onNotify != null)
            {
                this.onNotifyCallbacks.Add(onNotify);
            }

            this.followingPromise = new AbortablePromise();
            if (this.SynchronizationContext != null)
            {
                this.followingPromise.SynchronizationContext = this.SynchronizationContext;
            }

            return(this.followingPromise);
        }
Exemplo n.º 3
0
        public virtual IAbortablePromise OnError(Action <Exception> onRejected)
        {
            if (onRejected != null)
            {
                this.onRejectedCallbacks.Add(onRejected);
            }

            this.followingPromise = new AbortablePromise();
            if (this.SynchronizationContext != null)
            {
                this.followingPromise.SynchronizationContext = this.SynchronizationContext;
            }

            return(this.followingPromise);
        }
Exemplo n.º 4
0
        public virtual IAbortablePromise Finally(Action onFinally)
        {
            if (onFinally != null)
            {
                this.onFinallyCallbacks.Add(onFinally);
            }

            this.followingPromise = new AbortablePromise();
            if (this.SynchronizationContext != null)
            {
                this.followingPromise.SynchronizationContext = this.SynchronizationContext;
            }

            return(this.followingPromise);
        }
Exemplo n.º 5
0
        public virtual IAbortablePromise Then(Action <object> onFulfilled)
        {
            if (onFulfilled != null)
            {
                this.onFulfilledCallbacks.Add(onFulfilled);
            }

            this.followingPromise = new AbortablePromise();
            this.followingPromise.AbortRequested += BubbleAbortRequest;
            if (this.SynchronizationContext != null)
            {
                this.followingPromise.SynchronizationContext = this.SynchronizationContext;
            }

            return(this.followingPromise);
        }