Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

teneko/teronis-ts-auto-bind-es6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

autobind

With this little helper you can bind methods to 'this' easier.

Installation

npm install @teronis/ts-auto-bind-es6 --save

Usage

import { autoBind, getMethodNames } from "@teronis/ts-auto-bind-es6";

export class Child { }

export class Example extends Child {
    public constructor() {
        super();
        /** We bind each function (not arrow) to this except the child, because they are already overriden and referenced to connectors */
        autoBind(this, undefined, {
            excludedMethodNames: getMethodNames(Object.create(Child))
        });
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published