Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Dreaming

Christopher Tran pfftdammitchris

💭
Dreaming
View GitHub Profile
View singleton-design-pattern-in-java-script_2.js
function LocalStorage() {
let _data = {}
let _options = {}
return {
get(key) {
return _data[key]
},
set(key, value) {
_data[key] = value
View singleton-design-pattern-in-java-script_1.js
class LocalStorage {
#data = {}
constructor(options) {
this.options = options || {}
}
get(key) {
return this.#data[key]
}
View singleton-design-pattern-in-java-script_5.js
class LocalStorage {
#data = {}
static _instance = null
static getInstance(options) {
if (!LocalStorage._instance) {
LocalStorage._instance = new LocalStorage(options)
}
View singleton-design-pattern-in-java-script_4.js
function LocalStorage(options) {
let _data = {}
let _options = options || {}
return {
get(key) {
return _data[key]
},
set(key, value) {
_data[key] = value
View singleton-design-pattern-in-java-script_7.js
class LocalStorage {
#data = {}
static _instance = null
static getInstance(options) {
if (!LocalStorage._instance) {
LocalStorage._instance = new LocalStorage(options)
}
View singleton-design-pattern-in-java-script_5.js
class LocalStorage {
#data = {}
static _instance = null
static getInstance(options) {
if (!LocalStorage._instance) {
LocalStorage._instance = new LocalStorage(options)
}
View singleton-design-pattern-in-java-script_2.js
function LocalStorage() {
let _data = {}
let _options = {}
return {
get(key) {
return _data[key]
},
set(key, value) {
_data[key] = value