Save/Load last hack index
],
create: function() {
this.inherited(arguments);
- /*
- this.index = localStorage.getItem('hack.index');
- if (!this.index)
+ try {
+ this.index = localStorage.getItem('hack.index');
+ if (!this.index)
+ this.index = 0;
+ } catch(e) {
+ enyo.log("Could not load last hack index");
this.index = 0;
- */
- this.index = 0;
+ }
this.lastScrollPos = 0;
this.$.hacksCarousel.setCenterView(this.getHack(this.index));
},
//enyo.log('starting view ' + view);
if (view)
view.start();
- //localStorage.setItem('hack.index', this.index);
+ try {
+ localStorage.setItem('hack.index', this.index);
+ } catch(e) {
+ enyo.log("Could not set hack index");
+ }
},
stopHack: function(direction) {
var view = this.$.hacksCarousel.fetchView(direction || 'center');