Skip to content
This repository was archived by the owner on Dec 25, 2018. It is now read-only.

Commit 83f81c4

Browse files
author
electricessence
committed
Finalized Promise module structure and separated out final version of LazyPromise class.
This introduces smart defer methods which for LazyPromises do not trigger the underlying promise unless the consumer calls 'then'.
1 parent 4da16f8 commit 83f81c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1293
-665
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript-dotnet",
3-
"version": "2.16.6",
3+
"version": "2.17.0",
44
"ignore": [
55
".bowercc",
66
".gitignore",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*!
2+
* @author electricessence / https://github.com/electricessence/
3+
* Licensing: MIT
4+
*/
5+
import { Promise, PromiseBase } from "./Promise";
6+
export declare class LazyPromise<T> extends Promise<T> {
7+
private _resolver;
8+
constructor(_resolver: Promise.Executor<T>);
9+
protected _onDispose(): void;
10+
private _onThen();
11+
thenSynchronous<TResult>(onFulfilled: Promise.Fulfill<T, TResult>, onRejected?: Promise.Reject<TResult>): PromiseBase<TResult>;
12+
thenThis(onFulfilled: (v?: T) => any, onRejected?: (v?: any) => any): PromiseBase<T>;
13+
delayFromNow(milliseconds?: number): PromiseBase<T>;
14+
delayAfterResolve(milliseconds?: number): PromiseBase<T>;
15+
}
16+
export default LazyPromise;

dist/amd/System/Promises/LazyPromise.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/amd/System/Promises/LazyPromise.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/amd/System/Promises/Promise.d.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,15 @@ export declare abstract class Resolved<T> extends Resolvable<T> {
4242
}
4343
export declare class Promise<T> extends Resolvable<T> {
4444
private _waiting;
45-
constructor(resolver?: Promise.Executor<T>);
45+
constructor(resolver?: Promise.Executor<T>, forceSynchronous?: boolean);
4646
thenSynchronous<TResult>(onFulfilled: Promise.Fulfill<T, TResult>, onRejected?: Promise.Reject<TResult>): PromiseBase<TResult>;
4747
thenThis(onFulfilled: (v?: T) => any, onRejected?: (v?: any) => any): PromiseBase<T>;
4848
protected _onDispose(): void;
4949
protected _resolvedCalled: boolean;
50-
resolveUsing(resolver: Promise.Executor<T>, throwIfSettled?: boolean): void;
50+
resolveUsing(resolver: Promise.Executor<T>, forceSynchronous?: boolean, throwIfSettled?: boolean): void;
5151
resolve(result?: T, throwIfSettled?: boolean): void;
5252
reject(error: any, throwIfSettled?: boolean): void;
5353
}
54-
export declare class LazyPromise<T> extends Promise<T> {
55-
private _resolver;
56-
constructor(_resolver: Promise.Executor<T>);
57-
protected _onDispose(): void;
58-
private _onThen();
59-
thenSynchronous<TResult>(onFulfilled: Promise.Fulfill<T, TResult>, onRejected?: Promise.Reject<TResult>): PromiseBase<TResult>;
60-
thenThis(onFulfilled: (v?: T) => any, onRejected?: (v?: any) => any): PromiseBase<T>;
61-
}
6254
export declare module Promise {
6355
enum State {
6456
Pending = 0,
@@ -85,8 +77,6 @@ export declare module Promise {
8577
function resolve(): PromiseBase<void>;
8678
function resolve<T>(value: T | PromiseLike<T>): PromiseBase<T>;
8779
function reject<T>(reason: T): PromiseBase<T>;
88-
function lazy<T>(resolver: Promise.Executor<T>): LazyPromise<T>;
8980
function wrap<T>(target: PromiseLike<T>): PromiseBase<T>;
9081
function createFrom<T, TResult>(then: Then<T, TResult>): PromiseBase<T>;
91-
function pending<T>(resolver?: Promise.Executor<T>): Promise<T>;
9282
}

0 commit comments

Comments
 (0)