@@ -38,7 +38,7 @@ function StateManager() {
38
38
}
39
39
40
40
notifyListeners ( "volume" , [ options . volume ] ) ;
41
- if ( isKK ( ) ) notifyListeners ( "kkStart" ) ;
41
+ if ( isKK ( ) ) notifyListeners ( "kkStart" , [ options . kkVersion ] ) ;
42
42
else {
43
43
let musicAndWeather = getMusicAndWeather ( ) ;
44
44
notifyListeners ( "hourMusic" , [ timeKeeper . getHour ( ) , musicAndWeather . weather , musicAndWeather . music , false ] ) ;
@@ -75,6 +75,7 @@ function StateManager() {
75
75
enableNotifications : true ,
76
76
enableKK : true ,
77
77
alwaysKK : false ,
78
+ kkVersion : 'live' ,
78
79
paused : false ,
79
80
enableTownTune : true ,
80
81
//enableAutoPause: false,
@@ -95,7 +96,6 @@ function StateManager() {
95
96
weather : options . weather
96
97
} ;
97
98
98
- console . log ( options . music )
99
99
if ( options . music === "random" ) {
100
100
let games = [
101
101
'animal-crossing' ,
@@ -132,7 +132,7 @@ function StateManager() {
132
132
timeKeeper . registerHourlyCallback ( ( day , hour ) => {
133
133
let wasKK = isKK ( ) ;
134
134
isKKTime = day == 6 && hour >= 20 ;
135
- if ( isKK ( ) && ! wasKK ) notifyListeners ( "kkStart" ) ;
135
+ if ( isKK ( ) && ! wasKK ) notifyListeners ( "kkStart" , [ options . kkVersion ] ) ;
136
136
else if ( ! isKK ( ) ) {
137
137
let musicAndWeather = getMusicAndWeather ( ) ;
138
138
notifyListeners ( "hourMusic" , [ hour , musicAndWeather . weather , musicAndWeather . music , true ] ) ;
@@ -143,6 +143,7 @@ function StateManager() {
143
143
// of any pertinent changes.
144
144
chrome . storage . onChanged . addListener ( changes => {
145
145
let wasKK = isKK ( ) ;
146
+ let kkVersion = options . kkVersion ;
146
147
let oldMusicAndWeather = getMusicAndWeather ( ) ;
147
148
getSyncedOptions ( ( ) => {
148
149
if ( typeof changes . zipCode !== 'undefined' ) weatherManager . setZip ( options . zipCode ) ;
@@ -154,7 +155,7 @@ function StateManager() {
154
155
notifyListeners ( "gameChange" , [ timeKeeper . getHour ( ) , musicAndWeather . weather , musicAndWeather . music ] ) ;
155
156
}
156
157
157
- if ( isKK ( ) && ! wasKK ) notifyListeners ( "kkStart" ) ;
158
+ if ( ( isKK ( ) && ! wasKK ) || kkVersion != options . kkVersion ) notifyListeners ( "kkStart" , [ options . kkVersion ] ) ;
158
159
if ( ! isKK ( ) && wasKK ) {
159
160
let musicAndWeather = getMusicAndWeather ( ) ;
160
161
notifyListeners ( "hourMusic" , [ timeKeeper . getHour ( ) , musicAndWeather . weather , musicAndWeather . music , false ] ) ;
@@ -171,11 +172,11 @@ function StateManager() {
171
172
} ) ;
172
173
} ) ;
173
174
} ) ;
175
+
176
+ // Make notifyListeners public to allow for easier notification sending.
177
+ window . notify = notifyListeners ;
174
178
175
- // Gives easy access to the notifyListeners function if
176
- // we're debugging.
177
179
if ( DEBUG_FLAG ) {
178
- window . notify = notifyListeners ;
179
180
window . setTime = function ( hour , playTownTune ) {
180
181
notifyListeners ( "hourMusic" , [ hour , options . weather , options . music , playTownTune ] ) ;
181
182
} ;
0 commit comments