Files
DefinitelyTyped/types/update-notifier/update-notifier-tests.ts
dwieeb 1660072278 [update-notifier] Make options optional for v1, add v2 types (#23007)
* [update-notifier] Make options optional

* [update-notifier] Add v2 types with isGlobal addition

* Older versions goes in subdirectories
2018-01-18 12:53:58 -08:00

34 lines
754 B
TypeScript

import UpdateNotifier = require("update-notifier");
let notifier = UpdateNotifier();
if (notifier.update) {
notifier.notify();
}
console.log(notifier.update);
// Also exposed as a class
notifier = new UpdateNotifier.UpdateNotifier({
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week
});
if (notifier.update) {
notifier.notify(); // test no options
notifier.notify({}); // test empty object
// test all options
notifier.notify({
message: 'Update available: ' + notifier.update.latest,
defer: false,
isGlobal: true,
boxenOpts: {
padding: 1,
margin: 1,
align: 'center',
borderColor: 'yellow',
borderStyle: 'round',
},
});
}