cburschka / cadence

A strophe.js-powered XMPP web client for chatrooms.
6 stars 2 forks source link

Use arrow functions #359

Closed cburschka closed 8 years ago

cburschka commented 8 years ago

Arrow functions have one big advantage over standard anonymous function literals: They inherit this from the outer scope, allowing it to be used without having to assign it to another local variable or pass it as an argument or use .bind(this).

The xmpp code in cadence does this quite a lot when passing callbacks to Strophe.

The anonymous literals should be replaced with arrow literals, and if named functions are passed, they should be wrapped in arrow literals which call the old function to maintain its binding.

cburschka commented 8 years ago

(See #328 )