-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0dc732
commit 59ce37d
Showing
2 changed files
with
72 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* tslint:disable:no-console */ | ||
import { detect } from '../src'; | ||
|
||
const result = detect(); | ||
if (result) { | ||
switch (result.type) { | ||
case 'bot': | ||
// result is an instanceof BotInfo | ||
console.log(`found ${result.name} bot`); | ||
break; | ||
|
||
case 'bot-device': | ||
// result is an instanceof SearchBotDeviceInfo | ||
console.log(`found ${result.name} device bot`); | ||
break; | ||
|
||
case 'browser': | ||
// result is an instanceof BrowserInfo | ||
console.log(`found ${result.name} browser`); | ||
break; | ||
|
||
case 'node': | ||
// result is an instanceof NodeInfo | ||
console.log(`found node version ${result.version}`); | ||
break; | ||
} | ||
} |