UPDATETypeScript是否支持TouchEvent?
TypeScript 1.5.3 added declarations for HTML Touch events to lib.d.ts
我可以看到它支持的UIEvent,但它似乎並沒有對觸摸事件的接口。
此代碼指示「TouchEvent在當前範圍內不存在」。
class Touchy {
private _element:Element;
constructor(theElement:Element) {
this._element = theElement;
theElement.addEventListener("touchstart", (theTouchEvent:TouchEvent) => alert("touchy"));
}
}
我可以使用UIEvent,但不能使用TouchEvent。如何使用TypeScript處理TouchEvent?謝謝。
@norahiko有Github上項目與方法是:https://github.com/norahiko/TouchEvent.d.ts –
這。 :[github.com/borisyankov/DefinitelyTyped/touch-events/touch-events.d.ts](https://github.com/borisyankov/DefinitelyTyped/blob/master/touch-events/touch-events.d.ts ) – harry0000