Closed minutephp closed 6 years ago
Unfortunately, there isn't. I wrote this library before TypeScript really became popular. I'd take a pull request happily. TypeScript and Elm are technologies I'm pretty interested in at the moment, though, so I may go through my old stable libraries and TS them once TS 2.0 is released.
That's great news. I'm learning typescript myself but I'm able to use the above d.ts in my project (it is much better than making everything any
). Once I have enough command of the language I will put in the PR (unless you get it to it first ;) Thanks for the amazing lib and response!
You're welcome. Glad you like it!
One more question since I've started using this library.. what the equivalent of event.stopImmediatePropogation()
with Eev?
I mean if some events want to stop other events from handling an emit
is there a way to do it currently? And on a related note, in what priority do the events.on
get called?
Thanks!
Nope. It wouldn't be hard to bake in, I don't think, but it would probably be a breaking change. We'd either have to add something like stopImmediatePropogation
to the data object which is being passed to emit, or else do the cancelation based on the return value.
You can work around this by putting this somewhere:
;(function () {
var superOn = Eev.prototype.on;
Eev.prototype.on = function (names, fn) {
superOn.call(this, names, function (data) {
if (!data.isCanceled) {
return fn(data);
}
});
};
}());
Now, if any of your handlers sets isCanceled
to true on their data argument, none of the subsequent handlers should run.
Just realized you question about cancelation was on the same issue as TypeScript (which isn't closed).
I added the cancelation workaround to the markdown file. Let me know if you have issues with it. I didn't actually test that workaround, but the concept is valid and will work if properly implemented.
Hi,
Is there a
eev.d.ts
I can include in my typescript project?I think this should be enough?
Thanks, San