Does TypeScript support TouchEvent?

后端 未结 3 1031
别跟我提以往
别跟我提以往 2021-01-08 00:31

UPDATE

TypeScript 1.5.3 added declarations for HTML Touch events to lib.d.ts

I can see that it supports UIEven

3条回答
  •  半阙折子戏
    2021-01-08 01:20

    Here is a addendum. This code adds type event handlers to HTMLElement. You can add this after the code that defines the TouchEvent interface;

    //
    // add touch events to HTMLElement
    //
    interface HTMLElement extends Element, MSHTMLElementRangeExtensions, ElementCSSInlineStyle, MSEventAttachmentTarget, MSHTMLElementExtensions, MSNodeExtensions {
        ontouchstart: (ev: TouchEvent) => any;
        ontouchmove: (ev: TouchEvent) => any;
        ontouchend: (ev: TouchEvent) => any;
        ontouchcancel: (ev: TouchEvent) => any;
    }
    

提交回复
热议问题