Skip to content

Commit

Permalink
fix mixTo for ie
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore committed Jun 24, 2014
1 parent 4fded66 commit 4130cfe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions events.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,18 @@ Events.mixTo = function(receiver) {
var proto = Events.prototype

var event = new Events
keys(proto).forEach(function(key) {
for (var key in proto) {
if (proto.hasOwnProperty(key)) {
copyProto(key)
}
}

function copyProto(key) {
receiver[key] = function() {
proto[key].apply(event, Array.prototype.slice.call(arguments))
return this
}
})
}
}

// Execute callbacks
Expand Down

4 comments on commit 4130cfe

@afc163
Copy link
Member

@afc163 afc163 commented on 4130cfe Jan 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还有多处地方用了 Object.keysforEach

@popomore
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 commit 没有了吧,最新那个 commit 有

@lepture
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议不用兼容了,直接这样写,需要支持的自己打补丁。

@popomore
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arale 不怎么发展了,还是保持全兼容的

Please sign in to comment.