Method code for $event_handler.unhook_events()

[Turn off line numbering]
  1: arg type, @loc;
  2: var all, event, status, source;
  3: 
  4: if (events && events.contains(type)) {
  5:     all = events[type];
  6:     events = events.del(type);
  7:     loc = loc ? loc[1] : .location();
  8:     for event in (all) {
  9:         [event, [status, source]] = event;
 10:         switch (source) {
 11:             case 'location:
 12:                 (| loc.unhook_from_event(event) |);
 13:             case 'this:
 14:                 (| .unhook_from_event(event) |);
 15:             default:
 16:                 (| source.hook_into_event(event) |);
 17:         }
 18:         all = all.add(event, [0, source]);
 19:     }
 20:     events = events.add(type, all);
 21: }

// Created 17-Dec-1996 as a part of ColdCore, see: @help Credit

Tlon