Skip to content

Commit 46e644e

Browse files
author
Pete Richards
committed
Use key to retrieve default
1 parent af7954c commit 46e644e

File tree

6 files changed

+21
-54
lines changed

6 files changed

+21
-54
lines changed

example/localTimeSystem/src/LocalTimeSystem.js

+7-16
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,14 @@ define([
6767
return this._tickSources;
6868
};
6969

70-
LocalTimeSystem.prototype.defaults = function () {
70+
LocalTimeSystem.prototype.defaults = function (key) {
7171
var now = Math.ceil(Date.now() / 1000) * 1000;
72-
return [
73-
{
74-
key: 'local-default',
75-
name: 'Local 12 hour time system defaults',
76-
mode: 'fixed',
77-
bounds: {start: now - ONE_HOUR, end: now}
78-
},
79-
{
80-
key: 'local-default',
81-
name: 'Local 12 hour time system defaults',
82-
mode: 'follow',
83-
deltas: {start: THIRTY_MINUTES, end: 0},
84-
bounds: {start: now - THIRTY_MINUTES, end: now}
85-
}
86-
];
72+
return {
73+
key: 'local-default',
74+
name: 'Local 12 hour time system defaults',
75+
deltas: {start: THIRTY_MINUTES, end: 0},
76+
bounds: {start: now - THIRTY_MINUTES, end: now}
77+
};
8778
};
8879

8980
return LocalTimeSystem;

platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ define(
206206
return source.type() === sourceType;
207207
})[0];
208208
}
209-
209+
210210
/**
211211
* Change the selected Time Conductor mode. This will call destroy
212212
* and initialization functions on the relevant modes, setting

platform/features/conductor-v2/conductor/src/ui/modes/FixedMode.js

-10
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,6 @@ define(
4343
this.conductor.follow(false);
4444
};
4545

46-
FixedMode.prototype.defaults = function () {
47-
var timeSystem = this.timeSystem();
48-
49-
if (timeSystem){
50-
return timeSystem.defaults().filter(function (d) {
51-
return d.mode === 'fixed';
52-
})[0];
53-
}
54-
};
55-
5646
/**
5747
* Defines behavior to occur when selected time system changes. In
5848
* this case, sets default bounds on the time conductor.

platform/features/conductor-v2/conductor/src/ui/modes/FollowMode.js

-10
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,6 @@ define(
7777
return this._tickSource;
7878
};
7979

80-
FollowMode.prototype.defaults = function () {
81-
var timeSystem = this.timeSystem();
82-
83-
if (timeSystem){
84-
return timeSystem.defaults().filter(function (d) {
85-
return d.mode === 'follow';
86-
})[0];
87-
}
88-
};
89-
9080
/**
9181
* On time system change, default the bounds values in the time
9282
* conductor, using the deltas associated with this mode.

platform/features/conductor-v2/conductor/src/ui/modes/TimeConductorMode.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ define(
6363
};
6464

6565
TimeConductorMode.prototype.defaults = function () {
66-
throw new Error("Not implemented");
66+
var timeSystem = this.timeSystem(),
67+
key = this.key();
68+
69+
if (timeSystem) {
70+
return timeSystem.defaults(key);
71+
}
6772
};
6873

6974
TimeConductorMode.prototype.destroy = function () {

platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js

+7-16
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,14 @@ define([
6464
return this._tickSources;
6565
};
6666

67-
UTCTimeSystem.prototype.defaults = function () {
67+
UTCTimeSystem.prototype.defaults = function (key) {
6868
var now = Math.ceil(Date.now() / 1000) * 1000;
69-
return [
70-
{
71-
key: 'utc-default',
72-
name: 'UTC time system defaults',
73-
mode: 'follow',
74-
deltas: {start: FIFTEEN_MINUTES, end: 0},
75-
bounds: {start: now - FIFTEEN_MINUTES, end: now}
76-
},
77-
{
78-
key: 'utc-default',
79-
name: 'UTC time system defaults',
80-
mode: 'fixed',
81-
bounds: {start: now - FIFTEEN_MINUTES, end: now}
82-
}
83-
];
69+
return {
70+
key: 'utc-default',
71+
name: 'UTC time system defaults',
72+
deltas: {start: FIFTEEN_MINUTES, end: 0},
73+
bounds: {start: now - FIFTEEN_MINUTES, end: now}
74+
};
8475
};
8576

8677
return UTCTimeSystem;

0 commit comments

Comments
 (0)