HubSpot / messenger

Growl-style alerts and messages for your app. #hubspot-open-source
http://github.hubspot.com/messenger/
MIT License
4.02k stars 406 forks source link

Example of specifying messenger element #3

Closed TrevorBurnham closed 11 years ago

TrevorBurnham commented 11 years ago

The docs include an example with the line

messenger = new ActionMessenger $('div#message-container')

but ActionMessenger is scoped within the messenger.js file, and besides, the argument would have to be el: $('div#message-container').

I believe the simplest fix is to change the line in the docs to

messenger = $('div#message-container').messenger()
mjball commented 11 years ago

That overspecified selector makes me a sad :panda_face:.

zackbloom commented 11 years ago

But how will people ever understand how jquery works if I don't show it to them!?!?!?!

mjball commented 11 years ago

@zackbloom lolidk

zackbloom commented 11 years ago

Obvi:

var out = $('<ul>');
$.each(new Array(a), function(){ out.append($('<li>')); })
$.each(new Array(b), function(){ out.append($('<li>')); })
alert(out.children().length);

It's the only way.

roderyc commented 11 years ago

@zackbloom pls publish as jq plugin.

mjball commented 11 years ago

@roderyc v0.1a maybe. Too efficient for a v1 release.

TrevorBurnham commented 11 years ago

FYI, the example still doesn't work when you click "Run" because there's no element called #message-container on the page. Some other examples (like hookBackbone) have "Run" buttons but are no-ops as well. Maybe there should be separate "Examples" and "Advanced" sections, with all the runnable examples in the former.

zackbloom commented 11 years ago

Yea, I just made them all runnable in the interest of consistency. Fleshing out those others is a good idea.