Skip to content

Commit 0db7243

Browse files
committed
chore: split debug and debugToast
1 parent 25a997f commit 0db7243

File tree

6 files changed

+30
-28
lines changed

6 files changed

+30
-28
lines changed

src/base/home/index.refresh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22
import * as settings from 'src/utils/settings/index.js';
33
import { infoToast } from 'src/utils/2.toasts.js';
4-
import { debugToast } from 'src/utils/debug.js';
4+
import debugToast from 'src/utils/debugToast';
55
import onPage from 'src/utils/onPage.js';
66
import decrypt from 'src/utils/decrypt.emails.js';
77
import translate from 'src/utils/translate.js';

src/base/library/craft/disenchant.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import eventManager from 'src/utils/eventManager.js';
33
import * as settings from 'src/utils/settings/index.js';
44
import { global } from 'src/utils/global.js';
55
import { toast as fnToast } from 'src/utils/2.toasts.js';
6-
import { debug, debugToast } from 'src/utils/debug.js';
6+
import { debug } from 'src/utils/debug.js';
7+
import debugToast from 'src/utils/debugToast';
78
import * as cardHelper from 'src/utils/cardHelper.js';
89
import onPage from 'src/utils/onPage.js';
910
import * as hover from 'src/utils/hover.js';

src/base/underscript/updates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import luxon from 'luxon';
33
import * as settings from 'src/utils/settings/index.js';
44
import style from 'src/utils/style.js';
55
import wrap from 'src/utils/2.pokemon.js';
6-
import { debugToast } from 'src/utils/debug.js';
6+
import debugToast from 'src/utils/debugToast';
77
import { toast as BasicToast } from 'src/utils/2.toasts.js';
88
import sleep from 'src/utils/sleep.js';
99
import * as menu from 'src/utils/menu.js';

src/hooks/game.event.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import eventManager from 'src/utils/eventManager.js';
2-
import { debug, debugToast } from 'src/utils/debug.js';
2+
import { debug } from 'src/utils/debug.js';
3+
import debugToast from 'src/utils/debugToast';
34

45
eventManager.on('GameStart', function gameEvents() {
56
let finished = false;

src/utils/debug.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,10 @@
1-
import { toast } from './2.toasts.js';
2-
import merge from './merge.js';
3-
41
export function debug(message, permission = 'debugging', ...extras) {
52
if (!value(permission) && !value('debugging.*')) return;
63
// message.stack = new Error().stack.split('\n').slice(2);
74
console.log(`[${permission}]`, message, ...extras);
85
}
96

10-
export function debugToast(arg, permission = 'debugging') {
11-
if (!value(permission) && !value('debugging.*')) return false;
12-
if (typeof arg === 'string') {
13-
arg = {
14-
text: arg,
15-
};
16-
}
17-
const defaults = {
18-
background: '#c8354e',
19-
textShadow: '#e74c3c 1px 2px 1px',
20-
css: { 'font-family': 'inherit' },
21-
button: {
22-
// Don't use buttons, mouseOver sucks
23-
background: '#e25353',
24-
textShadow: '#46231f 0px 0px 3px',
25-
},
26-
};
27-
return toast(merge(defaults, arg));
28-
}
29-
30-
function value(key) {
7+
export function value(key) {
318
const val = localStorage.getItem(key);
329
return val === '1' || val === 'true';
3310
}

src/utils/debugToast.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { toast } from './2.toasts.js';
2+
import merge from './merge.js';
3+
import { value } from './debug.js';
4+
5+
export default function debugToast(arg, permission = 'debugging') {
6+
if (!value(permission) && !value('debugging.*')) return false;
7+
if (typeof arg === 'string') {
8+
arg = {
9+
text: arg,
10+
};
11+
}
12+
const defaults = {
13+
background: '#c8354e',
14+
textShadow: '#e74c3c 1px 2px 1px',
15+
css: { 'font-family': 'inherit' },
16+
button: {
17+
// Don't use buttons, mouseOver sucks
18+
background: '#e25353',
19+
textShadow: '#46231f 0px 0px 3px',
20+
},
21+
};
22+
return toast(merge(defaults, arg));
23+
}

0 commit comments

Comments
 (0)