From 8e4bbd1aa6e8cfbb57f11886860eac88babdee3b Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Fri, 21 May 2021 22:52:34 +0300 Subject: [PATCH] feat: remove deprecated bind, short circuit if context === undefined --- src/api/context.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/api/context.ts b/src/api/context.ts index 292f50ea..e42c807a 100644 --- a/src/api/context.ts +++ b/src/api/context.ts @@ -76,24 +76,16 @@ export class ContextAPI { return this._getContextManager().with(context, fn, thisArg, ...args); } - /** - * Bind a context to a target function or event emitter - * @deprecated in 0.x, will be removed in 1.x - * - * @param target function or event emitter to bind - * @param context context to bind to the event emitter or function. Defaults to the currently active context - */ - public bind(target: T, context: Context = this.active()): T { - return this._getContextManager().bind(target, context); - } - /** * Bind a context to a target function or event emitter * * @param context context to bind to the event emitter or function. Defaults to the currently active context * @param target function or event emitter to bind */ - public bind(context: Context = this.active(), target: T): T { + public bind(context: Context, target: T): T { + if (context === undefined) { + return target; + } return this._getContextManager().bind(target, context); }