Merge pull request #2928 from vvakame/insight

add insight.d.ts
This commit is contained in:
Masahiro Wakame
2014-10-06 17:00:49 +09:00
3 changed files with 71 additions and 0 deletions

View File

@@ -144,6 +144,7 @@ All definitions files include a header with the author and editors, so at some p
* [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz))
* [Impress.js](https://github.com/bartaz/impress.js) (by [Boris Yankov](https://github.com/borisyankov))
* [Imagemagick](http://github.com/rsms/node-imagemagick) (by [Carlos Ballesteros Velasco](https://github.com/soywiz))
* [insight](https://github.com/yeoman/insight) (by [vvakame](https://github.com/vvakame))
* [interact.js](http://github.com/taye/interact.js) (by [Douglas Eichelberger](https://github.com/dduugg))
* [Ion.RangeSlider](https://github.com/IonDen/ion.rangeSlider) (by [Douglas Eichelberger](https://github.com/dduugg))
* [Ionic-Cordova](https://github.com/driftyco/) (by [Hendrik Maus](https://github.com/hendrikmaus))

21
insight/insight-tests.ts Normal file
View File

@@ -0,0 +1,21 @@
/// <reference path="./insight.d.ts" />
declare var require:any;
import Insight = require('insight');
var pkg:any = require('./package.json');
var insight = new Insight({
// Google Analytics tracking code
trackingCode: 'UA-XXXXXXXX-X',
packageName: pkg.name,
packageVersion: pkg.version
});
// ask for permission the first time
if (insight.optOut === undefined) {
return insight.askPermission();
}
insight.track('foo', 'bar');
// recorded in Analytics as `/foo/bar`

49
insight/insight.d.ts vendored Normal file
View File

@@ -0,0 +1,49 @@
// Type definitions for insight 0.4.3
// Project: https://github.com/yeoman/insight
// Definitions by: vvakame <http://github.com/vvakame>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module insight {
interface IOptions {
trackingCode:string;
trackingProvider?:string;
packageName:string;
packageVersion?:string;
config?:IConfigstore;
}
interface IConfigstore {
path:string;
all:any;
get(key:string):any;
set(key:string, val:any):void;
del(key:string):void;
}
}
declare module "insight" {
import IOptions = insight.IOptions;
import IConfigstore = insight.IConfigstore;
class Insight {
trackingCode:string;
trackingProvider:string;
packageName:string;
packageVersion:string;
os:string;
nodeVersion:string;
appVersion:string;
config:IConfigstore;
optOut:boolean;
clientId:string;
constructor(options:IOptions);
track(...args:string[]):void;
askPermission(msg?:string, cb?:Function):void;
}
export = Insight;
}