-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.js
More file actions
27 lines (24 loc) · 1000 Bytes
/
action.js
File metadata and controls
27 lines (24 loc) · 1000 Bytes
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
exports.Action = function (dict, plistCenter) {
this.sourceID = dict["source-id"]
this.sourceName = plistCenter.getNameOf(this.sourceID)
this.destinationID = dict["destination-id"]
this.destinationClassName = plistCenter.getClassOf(this.destinationID)
this.actionName = dict["label"]
var eventType = dict["event-type"]
if (typeof(eventType) == 'undefined') {
console.log("需要处理手势 " + this.sourceID)
//手势处理。
} else {
eventType.replace(/ /g, '')
eventType = dcfirst(eventType)
}
this.eventType = eventType
var description
description = this.sourceName + ".addTarget(self, action: #selector(" + this.destinationClassName + "." + this.actionName + "), for: ." + this.eventType + ")"
this.description = description
function dcfirst(str) {
str = str.replace(/\b\w+\b/g, function (word) {
return word.substring(0, 1).toLowerCase() + word.substring(1);
})
}
}