FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bear-react-carousel/src/logger.ts at main · urasmel/bear-react-carousel · GitHub
urasmel
bear-react-carousel
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
bear-react-carousel
/
src
/
logger.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
108 lines (91 loc) · 2.17 KB
Breadcrumbs
bear-react-carousel
/
src
/
logger.ts
Copy path
File metadata and controls
108 lines (91 loc) · 2.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import
elClassName
from
'./el-class-name'
;
const
baseStyles
=
[
'color: #fff'
,
'display: block'
,
'line-height: 20px'
,
'padding-right: 8px'
,
]
;
/**
* 輸出訊息
*
@param
title 標題
*
@param
styles 顯示樣式
*
@param
watchData 需要印出的訊息
*/
function
messageConsole
(
title
:
string
,
styles
:
any
,
watchData
?:
any
)
{
// eslint-disable-next-line no-console
console
.
log
(
`%c
${
title
}
`
,
styles
,
watchData
)
;
}
/**
* Primary (深藍)
*
@param
title
*
@param
watchData
*/
function
primary
(
title
:
string
,
watchData
?:
any
)
{
const
styles
=
baseStyles
.
concat
(
[
'background-color: #007bff'
,
]
)
.
join
(
';'
)
;
messageConsole
(
title
,
styles
,
watchData
)
;
}
/**
* Success (綠色)
*
@param
title
*
@param
watchData
*/
function
success
(
title
:
string
,
watchData
?:
any
)
{
const
styles
=
baseStyles
.
concat
(
[
'background-color: #28a745'
,
]
)
.
join
(
';'
)
;
messageConsole
(
title
,
styles
,
watchData
)
;
}
/**
* Info (天藍)
*
@param
title
*
@param
watchData
*/
function
info
(
title
:
string
,
watchData
?:
any
)
{
const
styles
=
baseStyles
.
concat
(
[
'background-color: #17a2b8'
,
]
)
.
join
(
';'
)
;
messageConsole
(
title
,
styles
,
watchData
)
;
}
/**
* Warning (黃色)
*
@param
title
*
@param
watchData
*/
function
warning
(
title
:
string
,
watchData
?:
any
)
{
const
styles
=
baseStyles
.
concat
(
[
'background-color: #ffc107'
,
]
)
.
join
(
';'
)
;
messageConsole
(
title
,
styles
,
watchData
)
;
}
/**
* Danger (紅色)
*
@param
title
*
@param
watchData
*/
function
danger
(
title
:
string
,
watchData
?:
any
)
{
const
styles
=
baseStyles
.
concat
(
[
'background-color: #ec2127'
,
]
)
.
join
(
';'
)
;
messageConsole
(
title
,
styles
,
watchData
)
;
}
function
printInText
(
log
:
any
,
elseInfo
=
true
)
{
const
dom
=
document
.
getElementById
(
elClassName
.
console
)
as
HTMLTextAreaElement
;
if
(
dom
)
{
const
day
=
new
Date
(
)
;
const
num
=
[
day
.
getMinutes
(
)
,
day
.
getSeconds
(
)
]
.
join
(
''
)
;
dom
.
value
=
`
${
num
}
:
${
log
}
\n
${
dom
.
value
}
`
;
}
else
if
(
elseInfo
)
{
info
(
'mobile'
,
log
)
;
}
}
const
logger
=
{
primary
,
success
,
info
,
warning
,
danger
,
printInText
,
}
;
export
default
logger
;
Back
|
FazBrowse Home
|
New Git URL