Created
July 2, 2014 15:20
-
-
Save Exodia/7e955f9c3a8dbf99dbf3 to your computer and use it in GitHub Desktop.
业务继承桥接实现
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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