Home › Forums › JavaScript › Revealing Module Pattern Inheritance › Reply To: Revealing Module Pattern Inheritance
September 24, 2014 at 9:09 am
#184656
Participant
NS.AlternateHelloModule = function(){
var helloModule = NS.HelloModule();
helloModule.sayHi = function(){
console.log("well hello agian");
};
return helloModule;
}
Or, if you want more inheritance:
return Object.assign(
Object.create( NS.HelloModule ),
{ sayHi: function(){ /* … */ } }
);
Object.assign
is ES6 but it’s easy to polyfill. It’s basically jQuery’s .extend
method.