Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Returning provided promise in addTask #1252

Merged
merged 1 commit into from
Jan 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const domainTaskBaseUrlStateKey = '__DOMAIN_TASK_INTERNAL_FETCH_BASEURL__DO_NOT_

let noDomainBaseUrl: string;

export function addTask(task: PromiseLike<any>) {
export function addTask<T>(task: PromiseLike<T>): PromiseLike<T> {
if (task && domain.active) {
const state = domainContext.get(domainTasksStateKey) as DomainTasksState;
if (state) {
Expand All @@ -32,6 +32,8 @@ export function addTask(task: PromiseLike<any>) {
});
}
}

return task;
}

export function run<T>(codeToRun: () => T, completionCallback: (error: any) => void): T {
Expand Down