User:Alive/System Refactor Plan: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
** Package device specific modules in build time
** Package device specific modules in build time
** Load/start modules correspondingly in run time
** Load/start modules correspondingly in run time
** Split business logic and UI logic
  // Possible pattern
  var MyCoreLogic = function() {};
  MyCoreLogic.prototype = {
    start: function() {
      switch (Service.query('getDeviceType')) {
        case 'phone':
          BaseModule.load(['phoneUI']).then(() => {
            this.ui = new PhoneUI(this);
          });
          break;
        case 'tv':
          BaseModule.load(['tvUI']).then(() => {
            this.ui = new TvUI(this);
          });
          break;
      }
    },
    handleEvent: function(evt) {
      this.ui.handleEvent(evt);
    },
    // called by UI
    writeDataBase: function() {},
    readDataBase: function() {}
  };


=== Swappable functionality ===
=== Swappable functionality ===
Confirmed users
401

edits

Navigation menu