Some caching fixes
This commit is contained in:
parent
e772a5b596
commit
c30d72d37c
@ -11,7 +11,7 @@
|
|||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
const CACHE_VERSION = { 'version': '0.0.887' };
|
const CACHE_VERSION = { 'version': '0.0.889' };
|
||||||
const PRECACHE = `jubileeData-${CACHE_VERSION.version}`;
|
const PRECACHE = `jubileeData-${CACHE_VERSION.version}`;
|
||||||
const RUNTIME = 'runtime';
|
const RUNTIME = 'runtime';
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ const LocationModel = Backbone.Model.extend({
|
|||||||
|
|
||||||
this.pos = 0;
|
this.pos = 0;
|
||||||
this.moveTimer = 0;
|
this.moveTimer = 0;
|
||||||
|
this.throttler = 0;
|
||||||
|
|
||||||
geolocation.options = geoOptions;
|
geolocation.options = geoOptions;
|
||||||
|
|
||||||
@ -50,7 +51,14 @@ const LocationModel = Backbone.Model.extend({
|
|||||||
geolocation.on('change', function( position) {
|
geolocation.on('change', function( position) {
|
||||||
console.log('Location update');
|
console.log('Location update');
|
||||||
const location = { 'latitude': position.coords.latitude, 'longitude': position.coords.longitude, 'timestamp': position.timestamp };
|
const location = { 'latitude': position.coords.latitude, 'longitude': position.coords.longitude, 'timestamp': position.timestamp };
|
||||||
this.processPosition(location);
|
|
||||||
|
const now = new Date();
|
||||||
|
if (now - this.throttler > 30000) {
|
||||||
|
this.processPosition(location);
|
||||||
|
this.throttler = now + 1000;
|
||||||
|
} else {
|
||||||
|
console.log('Throttling location update...');
|
||||||
|
}
|
||||||
|
|
||||||
// this.set('location', location);
|
// this.set('location', location);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
Loading…
Reference in New Issue
Block a user