Skip to content

Commit

Permalink
chore: remove withAsync from ContextManager interface
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarchaud committed Apr 25, 2020
1 parent 84b0fcf commit 3676212
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
9 changes: 4 additions & 5 deletions packages/opentelemetry-context-base/src/NoopContextManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ export class NoopContextManager implements types.ContextManager {
return Context.ROOT_CONTEXT;
}

with(context: Context, fn: Function) {
return fn();
}

withAsync(context: Context, fn: Function) {
with<T extends (...args: unknown[]) => ReturnType<T>>(
context: Context,
fn: T
): ReturnType<T> {
return fn();
}

Expand Down
11 changes: 0 additions & 11 deletions packages/opentelemetry-context-base/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ export interface ContextManager {
fn: T
): ReturnType<T>;

/**
* Run the async fn callback with an active scope
*
* @param scope Context to be active during function invocation
* @param fn An async callback to be immediately run with an active context
*/
withAsync<T extends Promise<any>, U extends (...args: unknown[]) => T>(
scope: Context,
fn: U
): Promise<T>;

/**
* Bind an object as the current context (or a specific one)
* @param target Any object to which a context need to be set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,4 @@ export class ZoneContextManager implements ContextManager {

return newZone.run(fn, context);
}

withAsync(context: Context, fn: Function) {
return fn();
}
}
4 changes: 0 additions & 4 deletions packages/opentelemetry-web/src/StackContextManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,4 @@ export class StackContextManager implements ContextManager {
this._currentContext = previousContext;
}
}

withAsync(context: Context, fn: Function) {
return fn();
}
}

0 comments on commit 3676212

Please sign in to comment.