valuechange events in javascript?
<p>I'm wondering how to attach an event listener to a variable... I know that sounds super weird so here's what I'm working with.</p>

<pre><code>B.viewController = function() {
  var view = 'large';

  var update = function() {
    if($(window).width() &gt;= 481) {
      var new-view = 'large';
      return view == new-view
    } else {
      var new-view = 'mobile';
      return view == new-view;
    }
  }

  update();

  $(window).resize(function() {
    update();
  });
};
</code></pre>

<p>now i'd like to expand this so that I can attach it as an event listener so for example I could use this to do something like coolImage.bind('B.viewController', callback) So that if the view changes the callback is called without having to attach a resize listener to the window...</p>
