Skip to content

Instantly share code, notes, and snippets.

@acl0056
Last active May 31, 2017 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acl0056/e16499863c25f22f90e5aa4abdb7fa85 to your computer and use it in GitHub Desktop.
Save acl0056/e16499863c25f22f90e5aa4abdb7fa85 to your computer and use it in GitHub Desktop.
// If localStorage is not really required, this will at least provide storage while the app is running.
var storage = typeof window.localStorage !== "unknown" ? window.localStorage : {
getItem: function(key) {
return (this.items || (this.items = {}))[key];
},
setItem: function(key, value) {
(this.items || (this.items = {}))[key] = value;
},
clear: function() {
this.items = {}
},
removeItem: function() {
delete (this.items || (this.items = {}))[key];
}
};
// And later, where you passed in window.localStorage, pass in storage instead.
TourService.prototype.start = function() {
this.tour = new window.Tour({
name: "ConfiguratorTour",
steps: [],
container: "body",
smartPlacement: !0,
keyboard: !0,
storage: storage,
debug: !1,
backdrop: !0,
backdropContainer: "body",
backdropPadding: 0,
redirect: !0,
orphan: !1,
duration: !1,
delay: !1,
basePath: ""
})
// ... And change
// window.localStorage.clear()
// to
storage.clear()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment