Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

Commit 4e2d434

Browse files
committed
feat: remove deprecated bind, short circuit if context === undefined
1 parent 59afb75 commit 4e2d434

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/api/context.ts

+4-12
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,16 @@ export class ContextAPI {
7676
return this._getContextManager().with(context, fn, thisArg, ...args);
7777
}
7878

79-
/**
80-
* Bind a context to a target function or event emitter
81-
* @deprecated in 0.x, will be removed in 1.x
82-
*
83-
* @param target function or event emitter to bind
84-
* @param context context to bind to the event emitter or function. Defaults to the currently active context
85-
*/
86-
public bind<T>(target: T, context: Context = this.active()): T {
87-
return this._getContextManager().bind(target, context);
88-
}
89-
9079
/**
9180
* Bind a context to a target function or event emitter
9281
*
9382
* @param context context to bind to the event emitter or function. Defaults to the currently active context
9483
* @param target function or event emitter to bind
9584
*/
96-
public bind<T>(context: Context = this.active(), target: T): T {
85+
public bind<T>(context: Context, target: T): T {
86+
if (context === undefined) {
87+
return target;
88+
}
9789
return this._getContextManager().bind(target, context);
9890
}
9991

0 commit comments

Comments
 (0)