Skip to content

Commit

Permalink
添加事件钩子
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyLouvre committed Aug 22, 2014
1 parent d72e258 commit d10016e
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 205 deletions.
12 changes: 8 additions & 4 deletions avalon.js
Expand Up @@ -2194,7 +2194,7 @@
}
return ret
}

function uniqSet(array) {
var ret = [], unique = {}
for (var i = 0; i < array.length; i++) {
Expand All @@ -2218,7 +2218,7 @@
}
return cache;
}

var cacheExprs = createCache(256)
//取得求值函数及其传参
var rduplex = /\w\[.*\]|\w\.\w/
Expand Down Expand Up @@ -2756,7 +2756,7 @@
}
elem.$vmodel = vmodels[0]
elem.$vmodels = vmodels
var eventType = data.param = data.param.replace(/-\d+$/, "") // ms-on-mousemove-10
var eventType = data.param.replace(/-\d+$/, "") // ms-on-mousemove-10
if (eventType === "scan") {
callback.call(elem, {type: eventType})
} else if (typeof data.specialBind === "function") {
Expand Down Expand Up @@ -3002,6 +3002,10 @@
"on": function(data, vmodels) {
var value = data.value,
four = "$event"
var eventType = data.param.replace(/-\d+$/, "") // ms-on-mousemove-10
if (typeof bindingHandlers.on[eventType + "Hook"] === "function") {
bindingHandlers.on[eventType + "Hook"](data)
}
if (value.indexOf("(") > 0 && value.indexOf(")") > -1) {
var matched = (value.match(rdash) || ["", ""])[1].trim()
if (matched === "" || matched === "$event") { // aaa() aaa($event)当成aaa处理
Expand Down Expand Up @@ -3069,7 +3073,7 @@
}
}
if (window.chrome) {
elem.addEventListener("DOMNodeRemovedFromDocument", function(){
elem.addEventListener("DOMNodeRemovedFromDocument", function() {
setTimeout(offTree)
})
} else {
Expand Down

0 comments on commit d10016e

Please sign in to comment.