Wintip
Simple console tools for Webview debugging.
Installation
yarn add wintip
or
npm install wintip
also
Usage
// Pass multiple parameters // Customize the tip colorconst colorTip = wintip
Log level
You can specify different levels of wintips by the following methods, and use the output
option of the wintip.config
method to control the output level of the wintip.
- wintip.info: info-level logs
- wintip.warn: warn-level logs
- wintip.error: error-level logs
wintip // Below the warn-level,not show // Below the warn-level,not showwintip // Equal the warn-level, showwintip // Above the warn-level, showwintip
API
wintip(msg1 [, msg2, ..., msgN)
Basic function, create a tip on the window.
// Object will be serialized // Return DOM nodeconst tip = tiptextContent = 'new message'
wintip.info(msg1 [, msg2, ..., msgN)
Show info-level wintips
wintip.warn(msg1 [, msg2, ..., msgN)
Show warn-level wintips, text color is #fee381
wintip.error(msg1 [, msg2, ..., msgN)
Show error-level wintips, text color is #ff4545
wintip.config(opts)
- output {
String
} Control display level, default'default'
. - console {
Boolean
} Proxy console.log method, defaultfalse
- opacity {
Number
} Background opacity, range0~1
, default0.75
. - color {
String
} base color of the tip, default'#fff'
, expectHEX
orRGB
string.
Global config. Please put it in your entry file or in the main file.
wintip
wintip.$(opts)
- color {
String
} specify the tip color, expectHEX
orRGB
value. - level {
String
} log level: 'default', 'info', 'warn', 'error'
Create a tip with options.
const yellowTip = wintipconst orangeTip = wintip // Quick usagewintip'balabala'
wintip.$(name [, opts])
- name {
String
|Number
} name of the tip. - opts {
Object
} optional.- color {
String
} specify the tip color, expectHEX
orRGB
value. - level {
String
} log level: 'default', 'info', 'warn', 'error'
- color {
Create a tip with names and options(optional). Note: the named tip can be reused.
// Return a tip functionconst fooTip = wintip // Quick usagewintip'balabala'
wintip.remove(target)
Remove a tip
wintip'foo tip'const tip = // Remove first tip in windowwintip // Remove the tip named foowintip // Remove tip nodewintip