Skip to content

Commit

Permalink
0.1.1 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyun-J committed Apr 18, 2022
1 parent fc6fd8b commit 3ad8aaf
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions README-ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ detector.setting.clearConsole = false
다음과 같이 브라우저별로 동작할 감지기를 설정할 수 있습니다.
이때, 반드시 `getDetector()`가 최초 호출되기 이전에만 설정할 수 있습니다.
```js
import { BrowserDetectorConfig } from 'devtool-detector'
BrowserDetectorConfig.chrome = 'console-date'
BrowserDetectorConfig.firefox = 'debugger'
import { BrowserDetector } from 'devtool-detector'
BrowserDetector.chrome = 'console-date'
BrowserDetector.firefox = 'debugger'
```
단, 브라우저별로 동작하는 감지기가 다릅니다.
기본값으로는 아래와 같이 설정되어 있습니다.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ The detailed types of detectors are as follows:
Can set up the detector to work on a browser-specific basis as follows:
At this time, it can only be set before `getDetector()` is first called.
```js
import { BrowserDetectorConfig } from 'devtool-detector'
BrowserDetectorConfig.chrome = 'console-date'
BrowserDetectorConfig.firefox = 'debugger'
import { BrowserDetector } from 'devtool-detector'
BrowserDetector.chrome = 'console-date'
BrowserDetector.firefox = 'debugger'
```
However, each browser has a different detector.
The default setting is as follows:
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export {
ConsoleDetectorSetting,
BrowserDetectorConfig,
}; // type export
export declare const BrowserDetectorConfig: BrowserDetectorConfig;
export declare const BrowserDetector: BrowserDetectorConfig;
export const getDetector: () => DebugDetector | ConsoleDetector;
export const addDetectListener: (listener: DevToolDetectListener) => void;
export const removeDetectListener: (listener: DevToolDetectListener) => void;
Expand Down
2 changes: 1 addition & 1 deletion index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "devtool-detector",
"version": "0.1.0",
"version": "0.1.1",
"description": "Simple browser devtool detector",
"types": "index.d.ts",
"main": "index.js",
Expand Down
8 changes: 4 additions & 4 deletions src/detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const isIE = /trident/i.test(userAgent) || /msie/i.test(userAgent)
const isEdgeLegacy = /edge/i.test(userAgent)
const isWebkit = /webkit/i.test(userAgent) && !isEdgeLegacy

const BrowserDetectorConfig = {
const BrowserDetector = {
chrome: 'debugger',
edgeLegacy: 'console-elem',
ie: 'console-elem',
Expand All @@ -27,7 +27,7 @@ const BrowserDetectorConfig = {
default: 'debugger'
}

Object.seal(BrowserDetectorConfig)
Object.seal(BrowserDetector)

const getBrouserName = () => {
if (isIE) return 'ie'
Expand All @@ -40,7 +40,7 @@ const getBrouserName = () => {
}

const defineDetector = () => {
const detector = BrowserDetectorConfig[getBrouserName()]
const detector = BrowserDetector[getBrouserName()]
switch (detector) {
case 'console-elem': return ElemDetector
case 'console-date': return DateDetector
Expand All @@ -50,7 +50,7 @@ const defineDetector = () => {
}
}

export { BrowserDetectorConfig }
export { BrowserDetector }
export const getDetector = () => {
if (_detector) return _detector
else {
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
requirejs(['../index.js'], ({ getDetector, addDetectListener, BrowserDetectorConfig }) => {
// BrowserDetectorConfig.chrome = 'console-date'
requirejs(['../index.js'], ({ getDetector, addDetectListener, BrowserDetector }) => {
// BrowserDetector.chrome = 'console-date'
const detector = getDetector()
// detector.setEnable(true)
detector.enable = true
Expand Down

0 comments on commit 3ad8aaf

Please sign in to comment.