@@ -286,6 +286,26 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
286286 }
287287 }
288288
289+ /**
290+ * Registers a callback function to be called when the configuration is refreshed.
291+ */
292+ onRefresh ( listener : ( ) => any , thisArg ?: any ) : Disposable {
293+ if ( ! this . #refreshEnabled && ! this . #featureFlagRefreshEnabled) {
294+ throw new Error ( "Refresh is not enabled for key-values or feature flags." ) ;
295+ }
296+
297+ const boundedListener = listener . bind ( thisArg ) ;
298+ this . #onRefreshListeners. push ( boundedListener ) ;
299+
300+ const remove = ( ) => {
301+ const index = this . #onRefreshListeners. indexOf ( boundedListener ) ;
302+ if ( index >= 0 ) {
303+ this . #onRefreshListeners. splice ( index , 1 ) ;
304+ }
305+ } ;
306+ return new Disposable ( remove ) ;
307+ }
308+
289309 async #refreshTasks( ) : Promise < void > {
290310 const refreshTasks : Promise < boolean > [ ] = [ ] ;
291311 if ( this . #refreshEnabled) {
@@ -315,26 +335,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
315335 }
316336 }
317337
318- /**
319- * Registers a callback function to be called when the configuration is refreshed.
320- */
321- onRefresh ( listener : ( ) => any , thisArg ?: any ) : Disposable {
322- if ( ! this . #refreshEnabled && ! this . #featureFlagRefreshEnabled) {
323- throw new Error ( "Refresh is not enabled for key-values or feature flags." ) ;
324- }
325-
326- const boundedListener = listener . bind ( thisArg ) ;
327- this . #onRefreshListeners. push ( boundedListener ) ;
328-
329- const remove = ( ) => {
330- const index = this . #onRefreshListeners. indexOf ( boundedListener ) ;
331- if ( index >= 0 ) {
332- this . #onRefreshListeners. splice ( index , 1 ) ;
333- }
334- } ;
335- return new Disposable ( remove ) ;
336- }
337-
338338 /**
339339 * Loads configuration settings from App Configuration, either key-value settings or feature flag settings.
340340 * Additionally, updates the `pageEtags` property of the corresponding @see PagedSettingSelector after loading.
0 commit comments