Comparing version 1.1.2 to 1.2.0
@@ -26,2 +26,6 @@ const cliSpinners = require('cli-spinners') | ||
this._nextSave = null | ||
this.config = { | ||
// 是否禁用当前实例的文本消息输出 | ||
disabled: false | ||
} | ||
} | ||
@@ -60,2 +64,4 @@ | ||
start (options, ...args) { | ||
if (this.config.disabled) return | ||
if (typeof options === 'string') return this.log(options) | ||
@@ -94,2 +100,3 @@ | ||
log (text) { | ||
if (this.config.disabled) return | ||
logUpdate(text) | ||
@@ -96,0 +103,0 @@ }, |
{ | ||
"name": "@ntbl/log", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "一个内置 loading 动画的命令行文本输入工具。", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,2 +10,3 @@ # log | ||
- [状态器](#状态器) | ||
- [开启或关闭](#开启或关闭) | ||
@@ -38,3 +39,3 @@ # Installation | ||
![](https://github.com/yeshimei/ntbl-log/blob/master/images/b.gif?raw=true) | ||
![](https://yeshimei.oss-cn-beijing.aliyuncs.com/20200531044104.gif) | ||
@@ -46,3 +47,3 @@ ```js | ||
![](https://github.com/yeshimei/ntbl-log/blob/master/images/d.gif?raw=true) | ||
![](https://yeshimei.oss-cn-beijing.aliyuncs.com/20200531044125.gif) | ||
@@ -60,4 +61,5 @@ | ||
![](https://github.com/sindresorhus/cli-spinners/raw/master/screenshot.svg?sanitize=true) | ||
![](https://yeshimei.oss-cn-beijing.aliyuncs.com/20200531050832.svg) | ||
log 内置了所有 [cli-spinners](https://github.com/sindresorhus/cli-spinners) 动画。 | ||
@@ -95,3 +97,3 @@ | ||
![](https://github.com/yeshimei/ntbl-log/blob/master/images/c.gif?raw=true) | ||
![](https://yeshimei.oss-cn-beijing.aliyuncs.com/20200531044116.gif) | ||
@@ -112,3 +114,3 @@ | ||
![](https://github.com/yeshimei/ntbl-log/blob/master/images/f.gif?raw=true) | ||
![](https://yeshimei.oss-cn-beijing.aliyuncs.com/20200531044138.gif) | ||
@@ -140,3 +142,3 @@ | ||
![](https://github.com/yeshimei/ntbl-log/blob/master/images/a.gif?raw=true) | ||
![](https://yeshimei.oss-cn-beijing.aliyuncs.com/20200531044042.gif) | ||
@@ -161,2 +163,15 @@ | ||
![](https://github.com/yeshimei/ntbl-log/blob/master/images/e.gif?raw=true) | ||
![](https://yeshimei.oss-cn-beijing.aliyuncs.com/20200531044132.gif) | ||
# 开启或关闭 | ||
log 支持一键开启或关闭文本输出了,这是为测试进行优化的功能。 | ||
log 在输出文本时会更新命令行界面,当进行排错或测试时,使用 `console` 等函数输出的文本会被覆盖。为了保证其正常使用,我们可以: | ||
```js | ||
log.config.disabled = true | ||
``` | ||
现在,当前实例所有的文本输出都被禁用了。 |
191
169
10688
11