Growl Notifications and Reading Speed

Published on 27th Aug, 2015

Growl notifications are pretty cool. I personally enjoy them greatly.To those of you who don't know, I'm speaking of those little bubbles that fade in on the top right of the screen to tell you something important, and then fade away.

There's a wealth of libraries that will generate growl notifications, certainly. But there's an implementation that takes an interesting element into account: Reading speed. Unnecessary, perhaps, but I'll let you decide.

Most growl APIs (sometimes called notify) give you an option that tells how many seconds, or milliseconds you want the notification to appear. I usually pick an arbitrary amount that errs on the side of being up too long, to make sure that the user gets a good chance to read it, regardless of its length. But what about this:

window.growl = function( message ) {
    wordCount = message.split(' ').length;
    duration  = Math.max(3000, (2000 + (Math.ceil(wordCount / 2.5) * 1000)));

    // call growl function and pass in duration.
}

What this does is assume that a person reads at 2.5 words/second (This also assumes that the growl function you are using takes milliseconds for the duration). The max function makes sure that it's at least 3 seconds, but you could of course change this to whatever you like. If it's a longer message, then you have a nice, variable duration that is hands-off and dependent totally on the number of words.

Of course if you're only ever sending short bursts of text, this won't be that useful, and even if you know you're going to be sending a few sentences, it would suffice to just set the duration to a higher number across the board. But I think this adds a level of finesse.

Take care,

Richard

This article is my 24th oldest. It is 289 words long

comments powered by Disqus