1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Merge branch 'hotfix/1.7.2' into production

This commit is contained in:
Denis Demchenko 2017-08-17 22:23:09 +03:00
commit af5e1d44e0
4 changed files with 103 additions and 50 deletions

View File

@ -1,5 +1,8 @@
# Bowser Changelog # Bowser Changelog
### 1.7.1 (August 17, 2017)
- [FIX] Fix typings.d.ts according to #185
### 1.7.1 (July 13, 2017) ### 1.7.1 (July 13, 2017)
- [ADD] Fix detecting of Tablet PC as tablet (#183) - [ADD] Fix detecting of Tablet PC as tablet (#183)

View File

@ -11,7 +11,7 @@
"ender", "ender",
"sniff" "sniff"
], ],
"version": "1.7.0", "version": "1.7.2",
"homepage": "https://github.com/lancedikson/bowser", "homepage": "https://github.com/lancedikson/bowser",
"scripts": [ "scripts": [
"src/bowser.js" "src/bowser.js"

View File

@ -1,6 +1,6 @@
{ {
"name": "bowser", "name": "bowser",
"version": "1.7.1", "version": "1.7.2",
"description": "Lightweight browser detector", "description": "Lightweight browser detector",
"keywords": [ "keywords": [
"browser", "browser",

146
typings.d.ts vendored
View File

@ -1,54 +1,104 @@
export const name: string // Type definitions for Bowser 1.x
export const osversion: string // Project: https://github.com/lancedikson/bowser
export const version: string // Definitions by: Paulo Cesar <https://github.com/pocesar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// grades declare const bowser: bowser.IBowser;
export const a: boolean export = bowser;
export const b: boolean export as namespace bowser;
export const c: boolean
// engines declare namespace bowser {
export const android: boolean
export const bada: boolean
export const blackberry: boolean
export const chrome: boolean
export const firefox: boolean
export const gecko: boolean
export const ios: boolean
export const msie: boolean
export const msedge: boolean
export const opera: boolean
export const phantom: boolean
export const safari: boolean
export const sailfish: boolean
export const seamonkey: boolean
export const silk: boolean
export const tizen: boolean
export const webkit: boolean
export const webos: boolean
export const mobile: boolean
export const tablet: boolean
// operating systems export interface IBowserOS {
export const chromeos: boolean mac: boolean;
export const iphone: boolean /**other than Windows Phone */
export const ipad: boolean windows: boolean;
export const ipod: boolean windowsphone: boolean;
export const firefoxos: boolean /**other than android, chromeos, webos, tizen, and sailfish */
export const linux: boolean linux: boolean;
export const mac: boolean chromeos: boolean;
export const touchpad: boolean android: boolean;
export const windows: boolean /** also sets one of iphone/ipad/ipod */
export const windowsphone: boolean ios: boolean;
blackberry: boolean;
firefoxos: boolean;
/** may also set touchpad */
webos: boolean;
bada: boolean;
tizen: boolean;
sailfish: boolean;
}
export function test(browserList: Flag[]): boolean export interface IBowserVersions {
export function isUnsupportedBrowser(minVersions:Object, strictMode?:Boolean, ua?:string): boolean chrome: boolean;
firefox: boolean;
msie: boolean;
msedge: boolean;
safari: boolean;
android: boolean;
ios: boolean;
opera: boolean;
phantom: boolean;
blackberry: boolean;
webos: boolean;
silk: boolean;
bada: boolean;
tizen: boolean;
seamonkey: boolean;
sailfish: boolean;
ucbrowser: boolean;
qupzilla: boolean;
vivaldi: boolean;
sleipnir: boolean;
kMeleon: boolean;
}
export type Flag = "a" | "b" | "c" | "android" | "bada" | "blackberry" export interface IBowserEngines {
| "chrome" | "firefox" | "gecko" | "ios" | "msie" /** IE <= 11 */
| "msedge" | "opera" | "phantom" | "safari" msie: boolean;
| "sailfish" | "seamonkey" | "silk" | "tizen" /**Chrome 0-27, Android <4.4, iOs, BB, etc. */
| "webkit" | "webos" | "chromeos" | "iphone" webkit: boolean;
| "ipad" | "ipod" | "firefoxos" | "linux" | "mac" /**Chrome >=28, Android >=4.4, Opera, etc. */
| "touchpad" | "windows" | "windowsphone" blink: boolean;
/**Firefox, etc. */
gecko: boolean;
/** IE > 11 */
msedge: boolean;
/** If a tablet device is detected, the flag tablet is set instead of mobile. */
tablet: boolean;
/** All detected mobile OSes are additionally flagged mobile, unless it's a tablet */
mobile: boolean;
}
export interface IBowserGrade {
/** Grade A browser */
a: boolean;
/** Grade C browser */
c: boolean;
/** Grade X browser */
x: boolean;
/**A human readable name for this browser. E.g. 'Chrome', '' */
name: string;
/**Version number for the browser. E.g. '32.0' */
version: string|number;
osversion: string|number;
}
export interface IBowserDetection extends IBowserGrade, IBowserEngines, IBowserOS, IBowserVersions { }
export interface IBowserMinVersions {
// { msie: "11", "firefox": "4" }
[index: string]: string;
}
export interface IBowser extends IBowserDetection {
(): IBowserDetection;
test(browserList: string[]): boolean;
_detect(ua: string): IBowser;
compareVersions(versions: string[]): number;
check(minVersions: IBowserMinVersions, strictMode?: boolean|string, ua?: string): Boolean;
isUnsupportedBrowser(minVersions: IBowserMinVersions, strictMode?: boolean|string, ua?: string): boolean;
}
}