@@ -628,71 +628,33 @@ class Events {
628628 }
629629
630630 /**
631- * Loads event data from cache
631+ * Loads event data from memory cache
632632 *
633633 * @returns {object[] } events
634634 */
635635 get ( ) {
636- if ( this . cache )
637- return this . cache ;
638-
639- this . cache = window . localStorage . getItem ( 'events_19hz' ) ;
640- if ( this . cache )
641- this . cache = JSON . parse ( this . cache ) ;
642-
643636 return this . cache ;
644637 }
645638
646639 /**
647- * Stores the event data to cache and adds a timestamp
640+ * Stores the event data to memory cache
648641 *
649642 * @param {object[] } events
650643 * @returns {object[] } events
651644 */
652645 set ( events ) {
653- try {
654- // Known to throw QuotaExceededException on Safari
655- window . localStorage . setItem ( 'events_19hz' , JSON . stringify ( events ) ) ;
656- window . localStorage . setItem ( 'events_19hz_age' , Date . now ( ) ) ;
657- } catch ( e ) {
658- console . error ( e ) ;
659- }
660646 this . cache = events ;
661647 return this . cache ;
662648 }
663649
664650 /**
665- * Returns the age of the cache
666- *
667- * @returns {number } events_age - Timestamp
668- */
669- age ( ) {
670- return window . localStorage . getItem ( 'events_19hz_age' ) ;
671- }
672-
673- /**
674- * Specifies if the age of the cache is old. Defaults to 24 hours
675- *
676- * @param {number } [old=86400000] - How long ago is considered old. Default: 24 hours
677- * @returns {boolean }
678- */
679- isFresh ( old = 86400000 ) {
680- let age = this . age ( ) ;
681- return age && age > ( Date . now ( ) - old ) ;
682- }
683-
684- /**
685- * Checks if the cache is old and updates it
651+ * Loads events by querying the CSV files
686652 *
687653 * @returns {Promise }
688654 */
689655 load ( ) {
690- if ( this . isFresh ( ) ) {
691- return Promise . resolve ( this . get ( ) ) ;
692- } else {
693- return this . query ( )
694- . then ( this . set . bind ( this ) ) ;
695- }
656+ return this . query ( )
657+ . then ( this . set . bind ( this ) ) ;
696658 }
697659
698660 /**
0 commit comments