-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathevent.go
36 lines (27 loc) · 798 Bytes
/
event.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package godom
// This file implements Event interface
// https://developer.mozilla.org/en-US/docs/Web/API/Event
import (
"github.com/gopherjs/gopherjs/js"
)
type Event struct {
*js.Object
}
// Properties
// https://developer.mozilla.org/en-US/docs/Web/API/Event/target
func (e Event) Target() *Object {
return &Object{e.Get("target")}
}
// Methods
// https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault
func (e Event) PreventDefault() {
e.Call("preventDefault")
}
// https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagation
func (e Event) StopImmediatePropagation() {
e.Call("stopImmediatePropagation")
}
// https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation
func (e Event) StopPropagation() {
e.Call("stopPropagation")
}