mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Update insight for recent changes (#22636)
* Update insight for recent changes updates the constructor options with `pkg`, which is now preferred over `packageName` and `packageVersion`. adds `trackEvent()` method * update insight test
This commit is contained in:
committed by
Mohamed Hegazy
parent
6d020e2e28
commit
9c0b47b45c
Vendored
+18
-3
@@ -1,13 +1,19 @@
|
||||
// Type definitions for insight 0.4.3
|
||||
// Type definitions for insight 0.8.0
|
||||
// Project: https://github.com/yeoman/insight
|
||||
// Definitions by: vvakame <https://github.com/vvakame>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace insight {
|
||||
interface IPackage {
|
||||
name: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
interface IOptions {
|
||||
trackingCode:string;
|
||||
trackingProvider?:string;
|
||||
packageName:string;
|
||||
pkg?:IPackage;
|
||||
packageName?:string;
|
||||
packageVersion?:string;
|
||||
config?:IConfigstore;
|
||||
}
|
||||
@@ -19,11 +25,19 @@ declare namespace insight {
|
||||
set(key:string, val:any):void;
|
||||
del(key:string):void;
|
||||
}
|
||||
|
||||
interface IEvent {
|
||||
category:string;
|
||||
action:string;
|
||||
label?:string;
|
||||
value?:number|string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import IPackage = insight.IPackage;
|
||||
import IOptions = insight.IOptions;
|
||||
import IConfigstore = insight.IConfigstore;
|
||||
import IEvent = insight.IEvent;
|
||||
|
||||
declare class Insight {
|
||||
trackingCode:string;
|
||||
@@ -41,6 +55,7 @@ declare class Insight {
|
||||
constructor(options:IOptions);
|
||||
|
||||
track(...args:string[]):void;
|
||||
trackEvent(event:IEvent):void;
|
||||
|
||||
askPermission(msg?:string, cb?:Function):void;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
|
||||
|
||||
declare var require:any;
|
||||
|
||||
import Insight = require('insight');
|
||||
var pkg:any = require('./package.json');
|
||||
var dummyPackage = {
|
||||
name: 'dummy',
|
||||
version: '1.0.0',
|
||||
};
|
||||
|
||||
var insight = new Insight({
|
||||
// Google Analytics tracking code
|
||||
trackingCode: 'UA-XXXXXXXX-X',
|
||||
packageName: pkg.name,
|
||||
packageVersion: pkg.version
|
||||
pkg: dummyPackage,
|
||||
});
|
||||
|
||||
(()=> {
|
||||
|
||||
Reference in New Issue
Block a user