Skip to content

Commit

Permalink
Merge pull request #284 from mikaelbr/revert-271-overwritable-timeout
Browse files Browse the repository at this point in the history
Revert "Allow timeout: false to remove a timeout"
  • Loading branch information
mikaelbr committed Aug 19, 2019
2 parents 722f9d9 + 5c48dc8 commit 3ae8fd7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 31 deletions.
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -186,7 +186,11 @@ notifier.notify(
**Note:** The `wait` option is shorthand for `timeout: 5`. This just sets a timeout
for 5 seconds. It does _not_ make the notification sticky!

As of 5.4.0, `timeout` defaults to `10`. In order to have a "fire and forgotten" notification, you need to set `timeout` to `false`.
Without `wait` or `timeout`, notifications are just fired and forgotten. They don't
wait for any response.

To make notifications wait for a response (like activation/click), you must define
a `timeout`.

_Exception:_ If `reply` is defined, it's recommended to set `timeout` to a either
high value, or to nothing at all.
Expand Down
8 changes: 0 additions & 8 deletions lib/utils.js
Expand Up @@ -210,14 +210,6 @@ module.exports.mapToMac = function(options) {
delete options.wait;
}

if (!options.wait && !options.timeout) {
if (options.timeout === false) {
delete options.timeout;
} else {
options.timeout = 10;
}
}

options.json = true;
return options;
};
Expand Down
22 changes: 0 additions & 22 deletions test/terminal-notifier.js
Expand Up @@ -277,28 +277,6 @@ describe('terminal-notifier', function() {
});
});

it('should not set a default timeout if explicitly false', function(done) {
var expected = [
'-title',
'"Title"',
'-message',
'"Message"',
'-json',
'"true"'
];

expectArgsListToBe(expected, done);
var notifier = new NotificationCenter();
notifier.isNotifyChecked = true;
notifier.hasNotifier = true;

notifier.notify({
title: 'Title',
message: 'Message',
timeout: false
});
});

it('should escape all title and message', function(done) {
var expected = [
'-title',
Expand Down

0 comments on commit 3ae8fd7

Please sign in to comment.