en.javascript.info/1-js/9-object-inheritance/15-class-inheritance/4-clock-class-extended/extended-clock.js
Ilya Kantor d4c714cbe1 work
2016-08-05 16:53:08 +03:00

14 lines
No EOL
344 B
JavaScript

function ExtendedClock(options) {
Clock.apply(this, arguments);
this._precision = +options.precision || 1000;
}
ExtendedClock.prototype = Object.create(Clock.prototype);
ExtendedClock.prototype.start = function() {
this._render();
var self = this;
this._timer = setInterval(function() {
self._render();
}, this._precision);
};