blob: be842f3ab88c639fcd4f6b7f0c1e3f54d7d31769 [file] [log] [blame]
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/** @interface */
class LocalStorageProxy {
/**
* @param {string} key
* @return {?string}
*/
getItem(key) {}
/**
* @param {string} key
* @param {string} value
*/
setItem(key, value) {}
}
/** @implements {LocalStorageProxy} */
export class LocalStorageProxyImpl {
/** @override */
getItem(key) {
return window.localStorage.getItem(key);
}
/** @override */
setItem(key, value) {
window.localStorage.setItem(key, value);
}
/** @return {!LocalStorageProxy} */
static getInstance() {
return instance || (instance = new LocalStorageProxyImpl());
}
}
/** @type {?LocalStorageProxy} */
let instance = null;