jQuery fn
sambenne opened this issue · 5 comments
You are doing
I think I remember seeing a way of doing both. Will have to find that out again.
Also, it is a bad practice to create bunch of anonymous functions on each 'toast message'. The good way is to use javascript prototypes. It could reduce memory usage by 5-15 times.
I've forked jquery toastmessage six months ago and improved it much (also added desktop notification support), see:
https://github.com/pbagwl/tire/blob/5daa5946420f20c5921e220d78162af4d777d7ec/js/tire.js#L218
Fork's syntax is:
Thanks for improving this, I was about to open an issue for the $() too.
@paulmillr your link is broken
@akquinet If you want people to pass in something ie. special dom element to use for a Toast message you would use something like this:
$.toastmessage({ dom: 'domElement' });
$.fn.toastmessage = function(){
$.toastmessage({ dom: this })
}
Thanks, did you write it in Coffeescript for kicks n' giggles or was it useful to do so?
As it was already rewritten by me in javascript, CoffeeScript version was made just for fun, yup.
I got tired from JS as a development language two months ago so I decided to learn CS and now I'm using it at work (with backbone.js). Great language, it eliminates many disadvantages of javascript or adds features, that would be available only in future (ecmascript harmony).