Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Add in scope-bound equivalents of addEvent, addEventInterval #6

Open
JoshuaKGoldberg opened this issue Jun 20, 2016 · 1 comment
Open

Comments

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Jun 20, 2016

Perhaps addEventBound and addEventIntervalBound?

See microsoft/TypeScript#6739 for guidance on implementation.

This will be useful for GameStartr projects: now that they're moving to not taking in the GameStartr instance as a first parameter, there will be some overhead in always having to pass () => scopes.

Old:

FSP.TimeHandler.addEvent(FSP.killNormal, 7, thing);

Current (either):

FSP.TimeHandler.addEvent(FSP.killNormal.bind(FSP), 7, thing);
FSP.TimeHandler.addEvent((thing: IThing): void => FSP.killNormal(thing), 7, thing);

With this:

FSP.TimeHandler.addEventBound(FSP.killNormal, FSP, 7, thing);
@JoshuaKGoldberg
Copy link
Member Author

See the discussion at palantir/tslint#1449 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant