コード例 #1
0
 public bool removeEventListener(string eventType, EventListener listener, EventListenerOptions options)
 {
     lock (this)
     {
         if (_eventEntries.TryGetValue(eventType, out var eventEntry))
         {
             var r = eventEntry.RemoveAll(x => x.options.capture == options.capture) > 0;
             if (eventEntry.Count == 0)
             {
                 _eventEntries.Remove(eventType);
             }
             return(r);
         }
     }
     return(false);
 }
コード例 #2
0
 public bool addEventListener(string eventType, EventListener listener, EventListenerOptions options)
 {
     lock (this)
     {
         if (_eventEntries.TryGetValue(eventType, out var eventEntry))
         {
             if (eventEntry.Any(x => x.options.capture == options.capture))
             {
                 return(false);
             }
             _eventEntries[eventType].Add(new EventEntry(listener, options));
             return(true);
         }
         _eventEntries[eventType] = new List <EventEntry> {
             new EventEntry(listener, options)
         };
         return(true);
     }
 }
コード例 #3
0
 public EventEntry(EventListener l, EventListenerOptions o)
 {
     listener = l; options = o;
 }