smoke.alert('this is a normal alert');
smoke.signal('this goes away after a sec');
smoke.confirm('behaves like a normal confirm?');
smoke.prompt('behaves like a normal prompt?');
You can implement these the same way you'd use the js alert()...just put "smoke." in front of it.
The confirm() replacement, however, needs to be used just a little differently:
smoke.confirm('this is still cool, yeah?',function(e){ if (e){ smoke.alert('OK pressed'); }else{ smoke.alert('CANCEL pressed'); } });
prompt(), similarly:
smoke.prompt('what\'s my name?',function(e){ if (e){ smoke.alert('my name is '+e); }else{ smoke.alert('no'); } });
And if you want the smoke.alert() to behave exactly like a native alert(), you can have subsequent actions happen in a callback like so:
smoke.alert('look at that alert, man.', {}, function(){ // oh what now? });
Want to do custom button labels? Try this:
smoke.alert('this is cool', {ok:"yeah it is"}); smoke.confirm('this is still cool, yeah?',function(e){ if (e){ smoke.alert('OK pressed'); }else{ smoke.alert('CANCEL pressed'); } }, {ok:"yeah it is", cancel:"no way"});
Need a default value for a prompt? Prepare to be amazed:
smoke.prompt('what\'s for dinner? (omg please say pizza, please say pizza)',function(e){ if (e){ smoke.alert(e); }else{ smoke.alert('no'); } },{value:"pizza"});
Maybe you want to specify different styles for a specific alert. Just add a classname parameter like this:
smoke.alert('this is cool', {classname:"myclassname"});