feat(frontend): store dev options in localStorage
This commit is contained in:
parent
e56fee3134
commit
9b66433348
2 changed files with 17 additions and 5 deletions
|
|
@ -1,6 +1,18 @@
|
|||
const KEY = "__OPENREPLAY_DEV_TOOLS__"
|
||||
|
||||
export const options = {
|
||||
verbose(verbose=true) {
|
||||
this.verbose = verbose
|
||||
localStorage.setItem(KEY, JSON.stringify(this))
|
||||
},
|
||||
enableCrash: false,
|
||||
logStuff: false,
|
||||
verbose: false,
|
||||
}
|
||||
|
||||
window.__OPENREPLAY_DEV_TOOLS = options;
|
||||
const storedString = localStorage.getItem(KEY)
|
||||
if (storedString) {
|
||||
const storedOptions = JSON.parse(storedString)
|
||||
Object.assign(options, storedOptions)
|
||||
}
|
||||
|
||||
window[KEY] = options
|
||||
|
|
@ -1,19 +1,19 @@
|
|||
import { options } from 'App/dev/console';
|
||||
|
||||
function log(...args) {
|
||||
if (!window.env.PRODUCTION || options.logStuff) {
|
||||
if (!window.env.PRODUCTION || options.verbose) {
|
||||
console.log(...args);
|
||||
}
|
||||
}
|
||||
|
||||
function warn(...args) {
|
||||
if (!window.env.PRODUCTION || options.logStuff) {
|
||||
if (!window.env.PRODUCTION || options.verbose) {
|
||||
console.warn(...args);
|
||||
}
|
||||
}
|
||||
|
||||
function error(...args) {
|
||||
if (!window.env.PRODUCTION || options.logStuff) {
|
||||
if (!window.env.PRODUCTION || options.verbose) {
|
||||
console.error(...args);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue