Преглед изворни кода

Fixes #806 Event listeners not triggered.

Functions need to be bound.
JC Brand пре 8 година
родитељ
комит
5efb7fbf82
2 измењених фајлова са 4 додато и 3 уклоњено
  1. 1 0
      docs/CHANGES.md
  2. 3 3
      src/converse-core.js

+ 1 - 0
docs/CHANGES.md

@@ -2,6 +2,7 @@
 
 
 ## 3.0.1 (Unreleased)
 ## 3.0.1 (Unreleased)
 
 
+- #806 The `_converse.listen` API event listeners aren't triggered. [jcbrand]
 - #807 Error: Plugin "converse-dragresize" tried to override HeadlinesBoxView but it's not found. [jcbrand]
 - #807 Error: Plugin "converse-dragresize" tried to override HeadlinesBoxView but it's not found. [jcbrand]
 
 
 ## 3.0.0 (2017-03-05)
 ## 3.0.0 (2017-03-05)

+ 3 - 3
src/converse-core.js

@@ -2208,9 +2208,9 @@
             }
             }
         },
         },
         'listen': {
         'listen': {
-            'once': _converse.once,
-            'on': _converse.on,
-            'not': _converse.off,
+            'once': _converse.once.bind(_converse),
+            'on': _converse.on.bind(_converse),
+            'not': _converse.off.bind(_converse),
             'stanza': function (name, options, handler) {
             'stanza': function (name, options, handler) {
                 if (_.isFunction(options)) {
                 if (_.isFunction(options)) {
                     handler = options;
                     handler = options;