Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

貌似可以优化 #1

Open
wsqviva opened this issue Nov 10, 2015 · 0 comments
Open

貌似可以优化 #1

wsqviva opened this issue Nov 10, 2015 · 0 comments

Comments

@wsqviva
Copy link

wsqviva commented Nov 10, 2015

  • try catch 感觉没必要吧,该报错给他自己报错吧
  • splice后,可以判断cbs.length删除_listenerMap[type], undo可能要判断下,有可能被删了
  • splice可以用spliceOne,效率高点
function spliceOne(list, index) {
  for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
    list[i] = list[k];
  }
  list.pop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant