This repository was archived by the owner on Sep 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Event.preventUpdate (suggestion) #1
Copy link
Copy link
Open
Description
Hello, thank you for this project :)
I am using the riot-typed package that is currently published on the NPM repository ( https://www.npmjs.com/package/riot-typed ), but instead of using Typings I simply reference your main Riot type definitions from my top-level declarations.d.ts:
/// <reference path="../node_modules/riot-typed/src/riot.d.ts" />I added this simple extension so that the preventUpdate property (which RiotJS attaches to DOM events) is typed properly:
declare interface RiotEvent extends Event {
preventUpdate: boolean;
}Say I have the following Riot Tag specification:
<riot-mytag>
<button onclick="{ onclickButton }">butt</button>
</riot-mytag>...I can then use the RiotEvent in place of MouseEvent (or more generally, lib.dom.Event):
// 'this' type is RiotTag
this.onclickButton = (ev: RiotEvent) => {
console.log("CLICK button");
ev.preventUpdate = true;
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels