Added update-notifier.d.ts

This commit is contained in:
vvakame
2014-04-01 00:30:31 +09:00
parent b01473b0c8
commit 8d5da26ea8
3 changed files with 56 additions and 0 deletions

View File

@@ -271,6 +271,7 @@ List of Definitions
* [Underscore.js (Typed)](http://underscorejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/))
* [Underscore-ko.js](https://github.com/kamranayub/UnderscoreKO) (by [Maurits Elbers](https://github.com/MagicMau))
* [universal-analytics](https://github.com/peaksandpies/universal-analytics) (by [Bart van der Schoor](https://github.com/Bartvds))
* [update-notifier](https://github.com/yeoman/update-notifier) (by [vvakame](https://github.com/vvakame))
* [urlrouter](https://github.com/fengmk2/urlrouter) (by [Carlos Ballesteros Velasco](https://github.com/soywiz))
* [UUID.js](https://github.com/LiosK/UUID.js) (by [Jason Jarrett](https://github.com/staxmanade))
* [Valerie](https://github.com/davewatts/valerie) (by [Howard Richards](https://github.com/conficient))

View File

@@ -0,0 +1,19 @@
/// <reference path="./update-notifier.d.ts" />
import updateNotifier = require('update-notifier');
var notifier = updateNotifier();
if (notifier.update) {
notifier.notify();
}
console.log(notifier.update);
var notifier = updateNotifier({
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week
});
if (notifier.update) {
notifier.notify('Update available: ' + notifier.update.latest);
}

36
update-notifier/update-notifier.d.ts vendored Normal file
View File

@@ -0,0 +1,36 @@
// Type definitions for update-notifier
// Project: https://github.com/yeoman/update-notifier
// Definitions by: vvakame <https://github.com/vvakame>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "update-notifier" {
function t(settings?:t.ISettings):t.IResult;
module t {
export interface IResult {
update: IUpdateInfo;
notify(message?:string):void;
}
export interface ISettings {
callback?:(error:any, update?:IUpdateInfo)=>any; // default null
packagePath?:string; // default 'package.json'
packageName?:string; // default Inferred from packageFile
packageVersion?:string; // default Inferred from packageFile
updateCheckInterval?:number; // default 1000 * 60 * 60 * 24 (1 day)
updateCheckTimeout?:number; // default 20000 (20 secs)
registryUrl?:string; // default 'http://registry.npmjs.org/%s'
}
export interface IUpdateInfo {
latest:string;
current:string;
type:string;
date:string;
name:string;
}
}
export = t;
}