Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. /**
  2. * A 1-way View Module
  3. */
  4. var simpleMVC = (function simpleMVC(simple) {
  5. 'use strict';
  6.  
  7. simple.OneWayView = function simpleOneWayView(model, selector) {
  8.  
  9. this._model = model;
  10. this._selector = selector;
  11.  
  12. // since not a 2-way, don't need to set this.onChanged
  13.  
  14. // attach model listeners
  15. this._model.onSet.attach(
  16. () => this.show()
  17. );
  18.  
  19. };
  20.  
  21. simple.OneWayView.prototype = {
  22. show() {
  23. this._selector.innerHTML = this._model.get();
  24. },
  25. };
  26.  
  27. return simple;
  28. })(simpleMVC || {});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement