Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
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
Returning provided promise in addTask
  • Loading branch information
rosieks committed Sep 2, 2017
commit 5a8fdc2a00039ff32bcbe11d97f1fd1cc18e4753
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