Merge pull request #17519 from JTOne123/master

added browser-report
This commit is contained in:
Paul van Brenk
2017-06-27 15:16:31 -07:00
committed by GitHub
3 changed files with 91 additions and 0 deletions
@@ -0,0 +1,12 @@
import 'browser-report';
function test_sync() {
var browserInfo = window.browserReportSync();
console.log(browserInfo.browser.name);
}
function test_async() {
window.browserReport((error, result) => {
console.log(result.ip + ' ' + result.browser.name);
});
}
+56
View File
@@ -0,0 +1,56 @@
// Type definitions for browser-report v2.2.9
// Project: https://github.com/JTOne123/browser-report
// Definitions by: Paul Datsiuk <https://github.com/JTOne123>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Window {
browserReport(result: (error: ErrorEvent, report: ReportResult) => any): void;
browserReportSync(): ReportResult;
}
interface ReportResult {
"browser": {
"name": string,
"version": string
},
"cookies": boolean,
"flash": {
"version": string
},
"ip": string,
"country": {
"name": string,
"code": string,
"city": string,
"latitude" : string,
"longitude": string,
"timezone": string
},
"java": {
"version": string
},
"lang": Array<string>,
"os": {
"name": string,
"version": string
},
"screen": {
"colors": number,
"dppx": number,
"height": number,
"width": number
},
"scripts": boolean,
"timestamp": string,
"userAgent": string,
"viewport": {
"height": number,
"layout": {
"height": number,
"width": number
}
"width": number,
"zoom": number
}
"websockets": boolean
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"browser-report-tests.ts"
]
}