title: Accessing functions across viewModels with knockout?
body: <p>I'm following RN's blog post here about pub/sub synchronization: </p>
  
  <p><a href="http://www.knockmeout.net/2012/05/using-ko-native-pubsub.html" rel="nofollow">http://www.knockmeout.net/2012/05/using-ko-native-pubsub.html</a></p>
  
  <p>My application has a 'shell' viewModel with various internal viewModels, one of which being 'folder'.  Within the folder viewmodel, I list folders.  </p>
  
  <p>From the shell's menu bar, I need to be able to add another folder.  This is the way I'm achieving it right now: </p>
  
  <p>In shell.js: </p>
  
  <pre><code>this.clickedAddFolder = ko.observable(false).publishOn("CLICKED_ADD_FOLDER");
  this.addFolder = function () { clickedAddFolder(true); clickedAddFolder(false); };
  </code></pre>
  
  <p>Then in folder.js: </p>
  
  <pre><code>var clickedAddFolder = ko.observable().subscribeTo("CLICKED_ADD_FOLDER");
  innerModel.addFolder = ko.computed(function() {
                  if (clickedAddFolder()) {
                      var folder = new folderViewModel(addFolderDto);
                      innerModel.folders.push(folder);
                      refreshIsotope();
                  }
              }).bind(this);
  </code></pre>
  
  <p>The idea is that shell.js will quickly toggle the clicked_add_folder property, which folder.js has subscribed to.  A computed observable detects this change and triggers some function - adding a folder.  Is this a reasonable solution?  I'd like to avoid finding a solution that "works"; I want to learn how to properly achieve this result.  </p>