Skip to content

Commit

Permalink
Remove bindAs from the doc
Browse files Browse the repository at this point in the history
Since bindAs is for internal use and doesn't export

Enact-DCO-1.0-Signed-off-by: Seungho Park <[email protected]>
  • Loading branch information
seunghoh committed Aug 24, 2023
1 parent 9cc6ea9 commit 972ea60
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/core/handle/handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
* `props` and `context`. This allows you to write consistent event handlers for components created
* either with `kind()` or ES6 classes without worrying about from where the props are sourced.
*
* Handlers can either be bound directly using the native `bind()` method or using the `bindAs()`
* utility method that is appended to the handler.
* Handlers can be bound directly using the native `bind()` method.
*
* Example:
* ```
Expand All @@ -42,12 +41,7 @@
* super();
*
* // logEnter will be bound to `this` and set as this.handleKeyDown
* //
* // Equivalent to the following with the advantage of set the function name to be displayed in
* // development tool call stacks
* //
* // this.handleKeyDown = logEnter.bind(this)
* logEnter.bindAs(this, 'handleKeyDown');
* this.handleKeyDown = logEnter.bind(this);
* }
*
* render () {
Expand Down Expand Up @@ -153,6 +147,7 @@ const named = (fn, name) => {
return fn;
};

// Setting the function name to be displayed in development tool call stacks rather than `anonymous`
const bindAs = (fn, obj, name) => {
const namedFunction = name ? named(fn, name) : fn;
const bound = namedFunction.bind(obj);
Expand Down

0 comments on commit 972ea60

Please sign in to comment.