Use prototype instead of this.myfunction inside functions