title: How should the model communicate?
body: <p>I am designing a JavaScript application that involves the editing of text based files, (aka code editor). Currently, I am working on the file explorer area of the application. I have divided it up into three MVC parts.</p>
  
  <ol>
  <li><p>The view, which manages the DOM Stricture (via jQuery primarily) and publishes user interactions to my applications mediator. (Eg. The user clicks "Add File", the view will ask for a name, then trigger the "files.new" event with the new name.)</p></li>
  <li><p>The controller. The controller will be receiving most of the events triggered by the view. From what I understand, the controller should be responsible for updating the model. If, for example, the view triggers the "files.nameChanged" event with the new name, the controller will handle that event by updating the model.</p></li>
  <li><p>The model. Currently the model is limited to just the raw data. There are no events or any kind of api. Which leads me into my question:</p></li>
  </ol>
  
  <p>How should the model communicate? I've considered exposing an API such as <code>model.updateRecord()</code>. But if I do that how can the view communicate which record should be updated? If the user changes the name of a file for example, how will the controller know which file was changed, and how will it communicate that to the model?</p>