lara-bind
v1.0.11
Published
simple bind function
Maintainers
Readme
lara-bind
lib para fazer bind em nivel de método de class
Instalação
npm i lara-bindImportação
import bind from 'lara-bind'
// OR
const bind = require('lara-bind')Uso
❌
class Game {
constructor() {
this.update = this.update.bind(this)
this.render = this.render.bind(this)
}
@bind()
update() {}
@bind()
render() {}
start() {
this.render()
this.update()
}
}
const game = new Game()
game.start()✅
import bind from 'lara-bind'
class Game {
@bind()
update() {}
@bind()
render() {}
start() {
this.render()
this.update()
}
}
const game = new Game()
game.start()