Use key to retrieve default

This commit is contained in:
Pete Richards 2016-08-05 14:44:18 -07:00
parent af7954c5a1
commit 46e644e6dc
6 changed files with 21 additions and 54 deletions

View File

@ -67,23 +67,14 @@ define([
return this._tickSources; return this._tickSources;
}; };
LocalTimeSystem.prototype.defaults = function () { LocalTimeSystem.prototype.defaults = function (key) {
var now = Math.ceil(Date.now() / 1000) * 1000; var now = Math.ceil(Date.now() / 1000) * 1000;
return [ return {
{
key: 'local-default', key: 'local-default',
name: 'Local 12 hour time system defaults', name: 'Local 12 hour time system defaults',
mode: 'fixed',
bounds: {start: now - ONE_HOUR, end: now}
},
{
key: 'local-default',
name: 'Local 12 hour time system defaults',
mode: 'follow',
deltas: {start: THIRTY_MINUTES, end: 0}, deltas: {start: THIRTY_MINUTES, end: 0},
bounds: {start: now - THIRTY_MINUTES, end: now} bounds: {start: now - THIRTY_MINUTES, end: now}
} };
];
}; };
return LocalTimeSystem; return LocalTimeSystem;

View File

@ -43,16 +43,6 @@ define(
this.conductor.follow(false); this.conductor.follow(false);
}; };
FixedMode.prototype.defaults = function () {
var timeSystem = this.timeSystem();
if (timeSystem){
return timeSystem.defaults().filter(function (d) {
return d.mode === 'fixed';
})[0];
}
};
/** /**
* Defines behavior to occur when selected time system changes. In * Defines behavior to occur when selected time system changes. In
* this case, sets default bounds on the time conductor. * this case, sets default bounds on the time conductor.

View File

@ -77,16 +77,6 @@ define(
return this._tickSource; return this._tickSource;
}; };
FollowMode.prototype.defaults = function () {
var timeSystem = this.timeSystem();
if (timeSystem){
return timeSystem.defaults().filter(function (d) {
return d.mode === 'follow';
})[0];
}
};
/** /**
* On time system change, default the bounds values in the time * On time system change, default the bounds values in the time
* conductor, using the deltas associated with this mode. * conductor, using the deltas associated with this mode.

View File

@ -63,7 +63,12 @@ define(
}; };
TimeConductorMode.prototype.defaults = function () { TimeConductorMode.prototype.defaults = function () {
throw new Error("Not implemented"); var timeSystem = this.timeSystem(),
key = this.key();
if (timeSystem) {
return timeSystem.defaults(key);
}
}; };
TimeConductorMode.prototype.destroy = function () { TimeConductorMode.prototype.destroy = function () {

View File

@ -64,23 +64,14 @@ define([
return this._tickSources; return this._tickSources;
}; };
UTCTimeSystem.prototype.defaults = function () { UTCTimeSystem.prototype.defaults = function (key) {
var now = Math.ceil(Date.now() / 1000) * 1000; var now = Math.ceil(Date.now() / 1000) * 1000;
return [ return {
{
key: 'utc-default', key: 'utc-default',
name: 'UTC time system defaults', name: 'UTC time system defaults',
mode: 'follow',
deltas: {start: FIFTEEN_MINUTES, end: 0}, deltas: {start: FIFTEEN_MINUTES, end: 0},
bounds: {start: now - FIFTEEN_MINUTES, end: now} bounds: {start: now - FIFTEEN_MINUTES, end: now}
}, };
{
key: 'utc-default',
name: 'UTC time system defaults',
mode: 'fixed',
bounds: {start: now - FIFTEEN_MINUTES, end: now}
}
];
}; };
return UTCTimeSystem; return UTCTimeSystem;