-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose the event types so it could be used with svelte typescript #1
Comments
Thank you for your suggestion. I will work on that on the next release. |
Event types now are shipped in the latest 1.1.4 version. First make sure you reference types in your tsconfig file: "include": [
"node_modules/ezgesture/types/*"
], Then you can use you the types globally in svelte without importing them: <button on:ezgdragstart="{onDragStart}"></button> Here in markup It will automatically check function type. but you have to do it manually in the function definition: function onDragStart(event: EZGDragEvent) {
console.log(event.detail.startX);
} For DOM Events. it will automatically do types for you: document.body.addEventListener("ezgdragstart", ev => {
console.log(ev.detail.startX)
}) List of available interfaces(Available globally): EZGDragEvent // for all drag events
EZGPinchStartEvent
EZGPinchMoveEvent
EZGPinchEndEvent
EZGLongPressEvent * Replace Event with Detail to get access to parameter types |
No description provided.
The text was updated successfully, but these errors were encountered: