Thread: libnotice
View Single Post
  #1  
Old 05-01-2007, 02:51 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
libnotice

PHP Code:
/***
*** Notification Centre (libnotice ) ***
+(void) addObsrver( object, recall, event );
+(void) remObserver( object );
-(void) postNotification( event, {params} );
***/

public function addObserverobjectrecallEventevent )
  {
  for ( 
temp.noticethis.notifications )
    {
    if ( 
temp.notice[0] != object )
      continue;
    if ( 
temp.notice[1] != recallEvent )
      continue;
    if ( 
temp.notice[2] != event )
      continue;
    
    return;
    }

  
this.notifications.add( {objectrecallEventevent } );
  return;
  }

public function 
remObserver( object )
  {
  for ( 
0this.notifications.size(); ++ )
    {
    if ( 
this.notifications[i][0] == object
      
|| this.notifications[i][0] == null // Shouldn't be here!
      
{
      
this.notifications.delete);
      
--;
      continue;
      }
    }

  return;
  }

function 
postNotificationeventparam )
  {
  
temp.eventParams = { this };
  
temp.eventParams.addarrayparam );

  for ( 
temp.noticethis.notifications )
    {
    if ( 
temp.notice[2] != event )
      continue;

    ( 
temp.notice[0] ).trigger(
        
temp.notice[1],
        
temp.eventParams );
    }
  return;
  } 
Reply With Quote