Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(event): definition for event #115

Merged
merged 2 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions types/wx/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ SOFTWARE.
/// <reference path="./lib.wx.cloud.d.ts" />
/// <reference path="./lib.wx.component.d.ts" />
/// <reference path="./lib.wx.behavior.d.ts" />
/// <reference path="./lib.wx.event.d.ts" />

declare namespace WechatMiniprogram {
type IAnyObject = Record<string, any>
Expand Down
53 changes: 53 additions & 0 deletions types/wx/lib.wx.event.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
declare namespace WechatMiniprogram {
interface Touch {
clientX: number
clientY: number
force: number
identifier: number
pageX: number
pageY: number
}
interface Event {
currentTarget: {
id: string,
dataset: {
[key: string]: string
},
offsetTop: number,
offsetLeft: number
}
target: {
id: string,
dataset: {
[key: string]: string
},
offsetTop: number,
offsetLeft: number
}
timeStamp: number
touches: Touch[]
mut: boolean
type: string
}
interface TapEvent extends Event {
changedTouches: []
detail: {
x: number,
y: number
}
type: "tap"
}

interface InputEvent extends Event {
changedTouches: []
detail: {
cursor: number
keyCode: number
value: string
}
type: "input"
}
}