An alternative to alert()
github.hubspot.com
github.hubspot.com
That's not an alternative to alert, that's just one more notification popup thing out of a billion or two.
It's an alternative to alert in the sense that you can use it to provide a better experience than {error: alert}. It's not a great option for modal alerts.
What browser does it not work on? We'll file an issue.
I've wanted a "just wait a minute, Javascript engine; let me look at what you're doing!" API call for quite a while.
Turns out there is one: you can put "debugger;" in any JS code, and (if you have Webkit Devtools or Firebug or what-have-you) it will act as if you had set a breakpoint right at that statement.
Much less diddling with the mouse to set a breakpoint in code you already had open in a text editor. Good complement to console.log :)
Though they're often known as merely "notifications", that's how Growl calls them and libnotify... well no need to spell it out.
What bank do you use?
It definitely makes sense to hide the dismissal button when there are interactions prompted that would get rid of it (Retry/Cancel), but the default case is a plain text message to the user.
By the way, I like it, thanks for putting it out there! A more unique name might help me find it for future projects :)
I also had a general problem with boxes disappearing. I tried opening a box with autohide after 10 seconds, then a box with a button. I positioned my mouse over the button but then the autohide box disappeared and the button moved away from my mouse! I seriously hate such UIs. Stuff should not move on a page, especially not if they are meant to be clicked. And text boxes should not disappear when I am half-way through reading them.
Don't get me wrong, the first thing I thought was "Gotta use this somewhere", but if I need Backbone (a great library for where it fits!) just to make alerts prettier, then no thanks.
Alert works in plain old javascript.
alert "Blammo! A coffeescript alert example"I'd venture to say less than 1% of people who know JavaScript also know CoffeeScript.
Personally, I was wondering what the language language it was.
I wish the examples were written in such a way that if I showed it to coworkers half of them wouldn’t roll their eyes.
https://github.com/jrf0110/backbone-events
Not sure if they're keeping it up to date however.
First of all, I'm not crazy about the other themes, but Future (the one enabled by default in the demo) is gorgeous. Maybe I'm just a fan of circular progress bars, but check out the demo involving "Error destroying alien planet." This is really pretty!
The stated use case for this is "transactional messages in your app." For that I think it fits pretty well. It might work as a debugging utility, similar to how we used alert() before we had console.log(), but it seems like the intended use case is for an end-user-facing interface.
Two minor gripes: 1) Backbone as a dependency for a UI element is kind of overkill. 2) This is more of a pet peeve, but why is the demo written in Coffeescript? I love Coffeescript and use it all the time, but I think it makes more sense for something like this to be demoed in Javascript. People who know Coffeescript are a subset of people who know Javascript, so you cater to a larger demographic this way.
That out of the way, great job on this. I'll have to find a project to use this in :)
Anyway...Nice work, zackbloom. The notifications look and work great.
In fact, I did: https://github.com/tlrobinson/xebug
1. The documentation is pretty lacking IMO. I would really like to see a unified "This is every option available to you" section. I have to dig through the code to figure out what is and isn't available.
2. Please do the docs in Javascript, otherwise it is very difficult to notice that you're actually passing TWO objects to $.globalMessenger.do().
3. A few of the code examples don't run, and a few don't look like they're meant to run. These should be in a separate 'notes' section (along with the options!)
4. Just an FYI, to get this to work with Backbone.LayoutManager I had to add manage:false to the Messenger and Message classes.
5. Why is the counter hidden in the future theme?
All in all a pretty solid library! Clearer documentation would do wonders but I am enjoying it so far. I really like the delay implementation, especially.
Re the counter, it is planned that the spinner would take the place of the countdown in the future theme. The messenger-retry-soon and messenger-retry-later classes are in there to make it possible, it just has to be wired up.
Any thoughts on #4, do you think it makes sense to always include {manage: false}?
Just a quick question - the $._messengerDefaults hash allows me to set a couple simple defaults across the app, but it appears that it can't set other defaults (e.g. showCloseButton). Is there an official way of setting this app-wide or do I need to just hack it in?
edit: merged!
Also, in the change location thing, can you show what the current setting is (make the corresponding box darker).
Filterable log messages, closable and easy to stub out when you go into production.
prettyAlert = function(obj){
alert(JSON.stringify(obj, null, 4));
}Also quite of few of the examples fail for me on Iceweasel, throwing reference errors for "msg" etc.
In that case I'd suggest not putting a big "run" button next to them and mixing them in with ones that are "runnable".
Or if you mean "they should look like they will cause a reference error" that would also be wrong - "each example runs with it's own scope" is not obvious.
Keep code that is purely "example code" and code that is intended for functionality demonstration separate. If you need to give example code as part of your explanation of the functionality it should appear with the explanation not in the same box as the demo code.
alert("Your request has succeded!");
is way easier than $.globalMessenger().post "Your request has succeded!" alert = $.globalMessenger().post
help?Each time you call globalMessenger() it gets a chance to do some checking to make sure it's at the right place on the page and has the right classes, but if you're not doing anything fancy (like injecting it into a page which keeps getting rewritten), this should be fine.
It seems like overkill for a function that's (mainly) used to debugging.
For debugging, you should probably use console.log.
alert = (args...) -> $globalMessenger().post args...
This allows $globalMessenger to be notified for upkeep whenever the call to .post is proxied.var logit = function(x){$('body').append('<div id=logit></div>');$('#logit').css({'background':'#000','position':'fixed','bottom':0,'right':0,'color':'#fff','padding':5,'font-family':'arial','font-size':'9px','z-index':9999});$('#logit').append(x+'<br>');};
It could very easily be adjusted for non-jquery too.
Then just call it like: logit(whateverYouWantToDisplay);