- return this.each (function() {
- var $this = $(this);
- instance=new Messages (options,$this);
- $this.data('Messages',instance);
- for (level in options.levels) {
- (function (instance,level) {
- $.subscribe("/messages/"+level, function (e, msg){ instance.display_message (msg,level)});
- }) (instance,level);
- }
- // kind of patchy, notify the convenience functions that somebody is listening...
- try {messages.ready=true;}
- catch (err) { console.log("Could not set messages.ready");}
- // this happens very early - even before the document is loaded
- // so it won't show right away; no big deal though
- $.publish ("/messages/info", 'Subscribed to all 5 message channels');
- });
- },
- destroy : function( ) {
-
- return this.each(function(){
- var $this = $(this), instance = $this.data('Messages');
- $(window).unbind('Messages');
- instance.remove();
- $this.removeData('Messages');
- });
- },
-/*
- reposition : function( ) { // ... },
- show : function( ) { // ... },
- hide : function( ) { // ... },
-*/
- update : function( content ) { },
- };