Solved:
The dispatcher.bind
is an asynchronous function so at the time I access the variable from this function:
jQuery(document).ready ($) ->
root = (exports ? this)
console.log root.channel_user
channel_user is still not assigned. To solve the problem i've added this line:
jQuery(document).ready ($) ->
dispatcher.bind "createuserchannel", () ->
root = (exports ? this)
console.log root.channel_user
In this way root.channel_user
will be called only when channel_user
has been setted.