These are chat archives for TypeStrong/atom-typescript

Jul 2015
Jul 30 2015 13:35

I have an issue which is admittedly a Typescript issue, not an atom-typescript issue, but I am hoping that somebody here can help me.

The problem is that I am creating a third-party JS object in a constructor of my own class, and one of the parameters to the third-party class is a callback.

I want to pass a method on my own TS class as the callback, but when the callback fires, it doesn't have access to the this of my object. Is there a way around that?

Lucien Greathouse
Jul 30 2015 16:32
Use method.bind(object) to forcefully bind a 'this' parmeter to method
That is, @kpgarrod
Jul 30 2015 16:35
Thanks. I tried that but the third-party module went into a loop
Dan Quirk
Jul 30 2015 18:43
@kpgarrod we (TypeScript) do have our own Gitter if you want to ask there
would recommend trying to just make a simple code example rather than use prose
StackOverflow is also always a good place to ask
some of us hang out there too
Mike Graham
Jul 30 2015 18:47
link to typescript gitter: