-
-
Notifications
You must be signed in to change notification settings - Fork 641
Dexie.derive()
David Fahlander edited this page May 6, 2014
·
6 revisions
Fixes the prototype chain for OOP inheritance.
function Vehicle () {
}
Vehicle.prototype.move = function() {
throw new Error ("Don't know how to move");
}
function Car() {
}
Dexie.derive(Car).from(Vehicle).extend(function() {
//
// Private closure scope for private methods
//
function privFunc() {
alert ("The wheels are rolling");
}
return {
//
// Public methods here (all methods are put on Car.prototype)
//
move: function() {
privFunc();
}
}
});
var car = new Car();
alert (car instanceof Vehicle);// alerts 'true'
car.move();
Dexie.js - minimalistic and bullet proof indexedDB library