forked from GetmeUK/ContentTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.coffee
More file actions
56 lines (40 loc) · 1.5 KB
/
Copy pathevents.coffee
File metadata and controls
56 lines (40 loc) · 1.5 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class ContentTools.Event
# The `Event` class provides information about events dispatched by
# `UIComponents`.
constructor: (name, detail) ->
# The name of the event
@_name = name
# Detail of the event (typically an object but can actually be set to
# any value).
@_detail = detail
# The date/time the event was created
@_timeStamp = Date.now()
# A flag indicating if the event has been cancelled
@_defaultPrevented = false
# A flag indicating if the execution of additional callbacks for the
# event has been halted.
@_propagationStopped = false
# Read-only properties
defaultPrevented: () ->
# Return true if the event has been cancelled
return @_defaultPrevented
detail: () ->
# Return the detail of the event
return @_detail
name: () ->
# Return the name of the event
return @_name
propagationStopped: () ->
# Return true if the event has been halted
return @_propagationStopped
timeStamp: () ->
# Return a time stamp of when the event was created
return @_timeStamp
# Methods
preventDefault: () ->
# Cancel the event preventing the default event action
@_defaultPrevented = true
stopImmediatePropagation: () ->
# Halt the event preventing any bound listener functions that have not
# yet been called for the event being called.
@_propagationStopped = true