Uncaught TypeError: undefined is not a function in RefluxJS

James Lei

Following the tutorials from this site: http://blog.krawaller.se/posts/the-reflux-data-flow-model/

I'm looking at replacing var chatRef to a dummy data instead of using new Firebase(...) as shown in the author example. Baffled how exactly this line read?

chatRef.on("value",this.updateChat.bind(this));

What is "value" and how bind work?

Tried to use var chatRef = {0: "Hello", 1: "Hello"} produce Uncaught TypeError: undefined is not a function

Brigand

chatRef appears to be an event emitter with at least one custom function (push).

You could mock it like this:

// you'll need to include an event emitter library
var chatRef = new EventEmitter(); 
chatRef.push = function(data, cb){
  // if push emits a value event?  not sure if it does
  this.emit('value', {val: function(){ return data });
  cb(null);
}

// emit a fake message every second
setInterval(function(){
  chatRef.push({text: "hey", from: "me", to: "them"}, function(){})
}, 1000);

If you don't get it, you should read up on event emitters.

For the .bind call google Function.prototoype.bind. In this case the bind just ensures that when the callback is called, it has the correct this value.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Uncaught TypeError:Undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function?

From Dev

Uncaught TypeError: undefined is not a function $

From Dev

Twitter Uncaught TypeError: undefined is not a function

From Dev

Reactjs: Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function - Javascript

From Dev

uncaught typeerror undefined is not a function on .empty()

From Dev

uncaught typeerror undefined is not a function in javascript

From Dev

Uncaught TypeError: Undefined is not a function on indexOf

From Dev

Uncaught TypeError: undefined is not a function for datatables

From Dev

Uncaught TypeError: undefined is not a function 'appendTo'

From Dev

Uncaught TypeError: undefined is not a function in datepicker

From Dev

Uncaught TypeError: undefined is not a function with jQuery

From Dev

Uncaught TypeError: undefined is not a function - checkValidity

From Dev

Uncaught TypeError: undefined is not a function:67

From Dev

Uncaught TypeError: undefined is not a function for datatables

From Dev

Another: uncaught typeerror undefined is not a function

From Dev

uncaught typeerror undefined is not a function on .empty()

From Dev

Uncaught TypeError: undefined is not a function in datepicker

From Dev

Uncaught TypeError: undefined is not a function - Slider

From Dev

Uncaught TypeError: undefined is not a function - datatables

From Dev

Uncaught TypeError undefined is not a function anonymous function

From Dev

Uncaught TypeError: undefined is not a function (anonymous function) in Wordpress

From Dev

Uncaught TypeError undefined is not a function anonymous function

Related Related

  1. 1

    Uncaught TypeError:Undefined is not a function

  2. 2

    Uncaught TypeError: undefined is not a function

  3. 3

    Uncaught TypeError: undefined is not a function

  4. 4

    Uncaught TypeError: undefined is not a function

  5. 5

    Uncaught TypeError: undefined is not a function

  6. 6

    Uncaught TypeError: undefined is not a function

  7. 7

    Uncaught TypeError: undefined is not a function?

  8. 8

    Uncaught TypeError: undefined is not a function $

  9. 9

    Twitter Uncaught TypeError: undefined is not a function

  10. 10

    Reactjs: Uncaught TypeError: undefined is not a function

  11. 11

    Uncaught TypeError: undefined is not a function - Javascript

  12. 12

    uncaught typeerror undefined is not a function on .empty()

  13. 13

    uncaught typeerror undefined is not a function in javascript

  14. 14

    Uncaught TypeError: Undefined is not a function on indexOf

  15. 15

    Uncaught TypeError: undefined is not a function for datatables

  16. 16

    Uncaught TypeError: undefined is not a function 'appendTo'

  17. 17

    Uncaught TypeError: undefined is not a function in datepicker

  18. 18

    Uncaught TypeError: undefined is not a function with jQuery

  19. 19

    Uncaught TypeError: undefined is not a function - checkValidity

  20. 20

    Uncaught TypeError: undefined is not a function:67

  21. 21

    Uncaught TypeError: undefined is not a function for datatables

  22. 22

    Another: uncaught typeerror undefined is not a function

  23. 23

    uncaught typeerror undefined is not a function on .empty()

  24. 24

    Uncaught TypeError: undefined is not a function in datepicker

  25. 25

    Uncaught TypeError: undefined is not a function - Slider

  26. 26

    Uncaught TypeError: undefined is not a function - datatables

  27. 27

    Uncaught TypeError undefined is not a function anonymous function

  28. 28

    Uncaught TypeError: undefined is not a function (anonymous function) in Wordpress

  29. 29

    Uncaught TypeError undefined is not a function anonymous function

HotTag

Archive