@eaboy/clean-console

中文文档
1.0.4发布于 2020/06/20MITTypeScriptCommonJS零依赖近 30 天下载 2325

A simple library to keep the console of your site or app clean

原始使用文档
文档目录3 节
  1. install
  2. usage
  3. Configuration options

clean-console

A simple library to keep the console of your site or app clean. No more logs, errors, warnings, etc. printed on the console and visible to everybody. You can also show fancy messages to your curious visitors.

clean-console with initial message

And if you want to see the logs for debugging, you can just set a local storage key to true and pass that key as part of the configuration.

clean-console with local storage key

install

npm i @eaboy/clean-console

usage

Default usage:

import { CleanConsole } from '@eaboy/clean-console';

CleanConsole.init() // Dafault behavior

Custom usage:

import { CleanConsole } from '@eaboy/clean-console';

CleanConsole.init(configOptions) // Object parameter for coustom options

You can also load directly clean-console.min.js in your page and call the init method in your code:

cleanConsole.init(configOptions) // Object parameter for coustom options

Configuration options

To customize the behavior you can pass a config object with the following properties. All properties are optional:

NameTypeDefaultDescriptionExample
excludeMethodsarrayPass an array of strings with the console methods you want to keep seeing on the consoleexcludeMethods: ['error', 'info', 'clear']
clearOnInitbooleanfalseSet it to true if you want to clear console before cleanConsole runs, useful if there are logs printed before the library it's initializedclearOnInit: true
debugLocalStoregeKeystringSet the local storage key that you want to use to block the execution of the library and be able to see all logs for debuggingdebugLocalStoregeKey: 'my_awesome_site_key'
initialMessagesarrayPass an array of objects with a property message which contains the message that you want to be displayed on the console and, optionally, a property style with the css style that you want to apply to the message. You can pass as many objects as messages you want to displayinitialMessages: { message: 'Thanks for visiting my awesome site!', style: 'color: red; font-size: 28px; font-weight: bold; font-family: "Comic Sans MS", cursive, sans-serif; line-height: 38px;' }

版本与发布记录

@eaboy/clean-console 共发布 5 个版本,首次发布于 2020/06/18;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.4latest2020/06/206 年前
1.0.32020/06/186 年前
1.0.22020/06/186 年前
1.0.12020/06/186 年前
1.0.02020/06/186 年前

关于 @eaboy/clean-console 的常见问题

@eaboy/clean-console 是什么?

A simple library to keep the console of your site or app clean

如何安装 @eaboy/clean-console?

在项目目录运行 npm install @eaboy/clean-console,或使用 pnpm add / yarn add / bun add。

@eaboy/clean-console 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eaboy/clean-console 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@eaboy/clean-console 可以商用吗?

@eaboy/clean-console 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@eaboy/clean-console 的下载量有多少?

根据 npm 官方下载统计,@eaboy/clean-console 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,325 次,日均约 78 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eaboy/clean-console 还在维护吗?

最新版本 1.0.4 发布于 2020/06/20(6 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/06/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。