javascript - Dojo subclass with different requires -
if have class 1 below, possible create subclass identical functionality override 1 of "requires"?
i'm trying use own version of /registry in example below. thanks
define([ "dojo/_base/declare", "dojo/query", "../registry", ], function(declare, query, registry){ return declare("dijit.form._searchmixin" { // original base code
if mean that:
you have class using modula
define(["modula"], function(modul){ return declare("classa", [], { dosomething: function() { modul.dosomething() } }) });
and declare class on basis of classa, should use modulb:
define(["classa", "modulb"], function(classa, modulb) { // magical dosomething use modulb return declare("classb", [classa]) {} })
it's not possible without overwriting functions use modula. if it's code, can write in way enables such polymorphism, using dynamic binding module:
define([], function(){ return declare("classa", [], { // dynamic binding, can overwritten modulname: "modula", dosomething: function() { require([this.modulname, function(modul) { // must take account, you're in async code modul.dosomething() } } }) });
Comments
Post a Comment