1
1
/**
2
2
* @license
3
- * Copyright 2017 Google Inc.
3
+ * Copyright 2017 Google LLC
4
4
*
5
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
6
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ fireauth.CacheRequest = function() {
42
42
/** @private {?goog.Promise} The cached returned promise result. */
43
43
this . cachedResult_ = null ;
44
44
/** @private {number} The expiration timestamp of the cached result. */
45
- this . expirationTime_ = goog . now ( ) ;
45
+ this . expirationTime_ = Date . now ( ) ;
46
46
/** @private {number} The time to live from the caching point in time. */
47
47
this . ttl_ = 0 ;
48
48
/** @private {boolean} Whether to cache errors too. */
@@ -62,7 +62,7 @@ fireauth.CacheRequest.prototype.cache =
62
62
this . func_ = func ;
63
63
this . self_ = self ;
64
64
this . arguments_ = args ;
65
- this . expirationTime_ = goog . now ( ) ;
65
+ this . expirationTime_ = Date . now ( ) ;
66
66
this . ttl_ = ttl ;
67
67
this . cacheErrors_ = ! ! opt_cacheErrors ;
68
68
@@ -79,9 +79,9 @@ fireauth.CacheRequest.prototype.run = function() {
79
79
throw new Error ( 'No available configuration cached!' ) ;
80
80
}
81
81
// If the result is not cached or the cache result is outdated.
82
- if ( ! this . cachedResult_ || goog . now ( ) >= this . expirationTime_ ) {
82
+ if ( ! this . cachedResult_ || Date . now ( ) >= this . expirationTime_ ) {
83
83
// Set expiration of current request.
84
- this . expirationTime_ = goog . now ( ) + this . ttl_ ;
84
+ this . expirationTime_ = Date . now ( ) + this . ttl_ ;
85
85
// Get new result and cache it.
86
86
this . cachedResult_ =
87
87
this . func_ . apply ( this . self_ , this . arguments_ ) . then ( function ( result ) {
@@ -93,7 +93,7 @@ fireauth.CacheRequest.prototype.run = function() {
93
93
if ( ! self . cacheErrors_ ) {
94
94
// Do not cache errors if errors are not to be cached.
95
95
// This will bust the cached result. Otherwise the error is cached.
96
- self . expirationTime_ = goog . now ( ) ;
96
+ self . expirationTime_ = Date . now ( ) ;
97
97
}
98
98
// Throw the returned error.
99
99
throw error ;
@@ -108,5 +108,5 @@ fireauth.CacheRequest.prototype.run = function() {
108
108
fireauth . CacheRequest . prototype . purge = function ( ) {
109
109
// Purge the cached results.
110
110
this . cachedResult_ = null ;
111
- this . expirationTime_ = goog . now ( ) ;
111
+ this . expirationTime_ = Date . now ( ) ;
112
112
} ;
0 commit comments