Skip to content

Instantly share code, notes, and snippets.


Mike McCaughan mikemccaughan

View GitHub Profile
mikemccaughan / FauxStorage.js
Created Jun 10, 2020
An object with a Storage API like interface that is backed by a Map, for use in sandboxed iframes.
View FauxStorage.js
// A sham for the Storage API that uses an `Map` backer and does not survive refresh
// (since Stack Snippets don't survive refresh). Might help with basic questions about
// the Storage API regarding serialization, or getting/setting values.
// Note you'll need to use localStore instead of localStorage and sessionStore instead
// of sessionStorage to use the shams.
class FauxStorage {
// private class fields do not have wide support as of this writing
// #store = new Map();
mikemccaughan /
Last active Jun 28, 2017
My list of Auto Comments for Stack Exchange sites

###[Q] More than one question asked It is preferred if you can post separate questions instead of combining your questions into one. That way, it helps the people answering your question and also others hunting for at least one of your questions. Thanks!

###[Q] Duplicate Closure This question will probably be closed as a duplicate soon. If the answers from the duplicates don't fully address your question please edit it to include why and flag this for re-opening. Thanks!

###[Q] Gimme teh codez Pure code-writing requests are off-topic on $SITENAME$ -- we expect questions here to relate to specific programming problems -- but we will happily help you write it yourself! Tell us what you've tried, and where you are stuck. This will also help us answer your question better.

###[Q] MCVE