Binding listeners lost RRS feed

  • Question

  • I have this scenario: 

    exports = {
      state: WinJS.Binding.as({
        user: null
    exports.state.bind("user", function(user) {
      if (user) {
      } else {
    WinJS.Namespace.define("app", exports);
    // Triggers the bound function
    app.state.user = new User();
    // This does not trigger the bound function
    app.state.user = null;
    // This now also does not trigger
    app.state.user = new User();

    Why are the listeners for the user object removed when I set it to null?

    edit: nevermind. I had a faulty app.state.unbind("user", undefined) somewhere in the app. That cleared all the listeners for good.
    • Edited by pkursawe Thursday, July 17, 2014 2:12 AM
    Thursday, July 17, 2014 2:07 AM


  • Marking as answered.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, July 17, 2014 7:12 PM