Skip to content

Instantly share code, notes, and snippets.

@Exodia
Created July 2, 2014 15:20
Show Gist options
  • Save Exodia/7e955f9c3a8dbf99dbf3 to your computer and use it in GitHub Desktop.
Save Exodia/7e955f9c3a8dbf99dbf3 to your computer and use it in GitHub Desktop.
业务继承桥接实现
// ub-ria/mvc/List.js
List.prototype.imp = null;
/**
* @params {er/Action} imp
*/
List.prototype.setImp = function (imp) {
this.imp = imp;
}
// A/List.js 继承 A/common/List.js
List.prototype.doCustomBehavior = function () { /*xxx*/ };
// B/List.js 继承 B/common/List.js
var AList = require('A/List');
List.prototype.doCustomBehavior = function () {
return this.imp.doCustomBehavior();
};
List.prototype.initBehavior = function () {
this.$super(arguments);
this.setImp(new AList());
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment