Comparing version
@@ -36,3 +36,3 @@ var __create = Object.create; | ||
} | ||
var IS_BROWSER = typeof window !== "undefined"; | ||
var IS_BROWSER = typeof window !== "undefined" && window.navigator.product === "Gecko"; | ||
var IS_UNSUPPORTED_CONSOLE = IS_BROWSER && /(\.stackblitz\.io|\.csb\.app)$/.test(location.host) && inIframe(); | ||
@@ -39,0 +39,0 @@ var SEPARATOR = /[-–—!$%^&*()_+|~=`{}\[\]:\/\\"'“”‘’;<>?,.@#\s\n\t\r]$/; |
{ | ||
"name": "tilg", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A tiny logger hook for debugging React components.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -5,2 +5,4 @@ # `useTilg` | ||
You can quickly try out the [**demo**](https://codesandbox.io/s/usetilg-3kdtz8?file=/src/App.js:274-359). | ||
<br/> | ||
@@ -10,15 +12,15 @@ | ||
- Installation | ||
- Features | ||
- Lifecycle Events (What) | ||
- Component Name and Props (Who) | ||
- Debug Message (Why) | ||
- What Has Changed? (Why) | ||
- Quick Logs (Why) | ||
- Advanced Features | ||
- Markdown | ||
- Return Original Value | ||
- Auto Deduplication | ||
- CLI Support | ||
- FAQ & Caveats | ||
- [Installation](#installation) | ||
- [Features](#features) | ||
- [Lifecycle Events (What)](#1-lifecycle-events-what) | ||
- [Component Name and Props (Who)](#2-component-name-and-props-who) | ||
- [Debug Message (Why)](#3-debug-message-why) | ||
- [What Has Changed? (Why)](#4-what-has-changed-why) | ||
- [Quick Logs (Why)](#5-quick-logs-why) | ||
- [Advanced Features](#advanced-features) | ||
- [Markdown](#markdown) | ||
- [Return Original Value](#return-original-value) | ||
- [Auto Deduplication](#auto-deduplication) | ||
- [CLI Support](#cli-support) | ||
- [FAQ & Caveats](#faq--caveats) | ||
@@ -115,3 +117,3 @@ <br/> | ||
When appending a [template literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) after the `useTilg()` call, it will also log it as the debug message: | ||
When appending a [template literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) to the `useTilg()` call, it will also be displayed as the debug message: | ||
@@ -128,3 +130,3 @@ ```jsx | ||
You can also know where the message is from: | ||
You can know where the message is from, too: | ||
@@ -296,7 +298,10 @@ <p align=center> | ||
- **Is it safe to ship code with `useTilg` to production?** | ||
- **Is it safe to ship code with `useTilg` to production?** | ||
Although `useTilg()` does nothing in a production build (`process.env.NODE_ENV === 'production'`) but only an empty function, I encourge you to remove the hook from the source code after finishing development your component. | ||
- **How do you implement this hook? What can I learn from the code?** | ||
- **How do you implement this hook? What can I learn from the code?** | ||
It is very hacky. Don't rely on it or try it in production, or [you will be fired](https://github.com/facebook/react/blob/0568c0f8cde4ac6657dff9a5a8a7112acc35a748/packages/react/index.js#L35). | ||
- **Why not design the API as `` useTilg`message` ``?** | ||
Then it will not be identified as a hook, React Refresh and HMR will not work correctly. | ||
@@ -303,0 +308,0 @@ <br/> |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22498
2.68%308
1.65%0
-100%