mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-18 04:24:30 +08:00
Added update-notifier.d.ts
This commit is contained in:
@@ -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))
|
||||
|
||||
19
update-notifier/update-notifier-tests.ts
Normal file
19
update-notifier/update-notifier-tests.ts
Normal 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
36
update-notifier/update-notifier.d.ts
vendored
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user