Register the given block to be called when the events of type +type+ will be emitted.
 if +once+, the block will be called once
435903
def add_listener(type, once=false, &callback)
      listener = Listener.new(type, callback, once)
      listeners[type] ||= []
      listeners[type] << listener
      emit(:new_listener, self, type, once, callback)
      listener
    end
211298
def register(*args, &block)
      h = Unobservable.handler_for(*args, &block)
      @handlers << h
      return h
    end
1121884
def register(self, ptype):
        """"""
        # Too many of them leads to memory burst
        if len(self.typedefs) < cfg.getint('typing', 'max_combiner'):
            self.typedefs.append(ptype)
            return True
        return False
328216
private void registerMethod(Class<?> type, Method method) {
    Class<?> returnType = method.getReturnType();
    if (returnType == void.class || returnType == Void.class) {
      registerVoidMethod(type, method);
    } else {
      registerValueMethod(type, method);
    }
  }
1335308
private function registerListeners(): void
    {
        Event::listen(ReactionHasBeenAdded::class, IncrementAggregates::class);
        Event::listen(ReactionHasBeenRemoved::class, DecrementAggregates::class);
    }
1210545
public static void onPostSetBlock(ISetBlockCallback callback, CallbackOption<ISetBlockCallbackPredicate> option)
	{
		postSetBlockRegistry.registerCallback(callback, option);
	}
466986
function addType(typeName, type) {
	if (types[typeName]) {
		throw new Error("Type already registered '" + typeName + "'");
	}
	types[typeName] = type;
}
1203224
private function initTypeGuesser()
    {
        $this->typeGuesserLoaded = true;

        $this->typeGuesser = $this->loadTypeGuesser();
        if (null !== $this->typeGuesser && !$this->typeGuesser instanceof BlockTypeGuesserInterface) {
            throw new UnexpectedTypeException($this->typeGuesser, 'Fxp\Component\Block\BlockTypeGuesserInterface');
        }
    }
817047
public void add(final ChronoStorageBlock block)
	{

		int revCount = block.getRevisionCounter();
		this.size += block.length();

		if (first == null) {
			first = block;
		}
		else {

			ChronoStorageBlock previous = null, current = first;
			do {
				if (revCount < current.getRevisionCounter()) {

					block.setCounterPrev(previous);
					block.setCounterNext(current);

					if (previous != null) {
						previous.setCounterNext(block);
					}

					current.setCounterPrev(block);

					if (current == this.first) {
						this.first = block;
					}

					return;
				}

				previous = current;
				current = current.getCounterNext();

			}
			while (current != null);

			// Add to end of list
			previous.setCounterNext(block);
			block.setCounterPrev(previous);
		}
	}
759100
private void addToSplitterQueue(Block<S, L> block) {
        ElementReference ref = splitters.referencedAdd(block);
        block.setSplitterQueueReference(ref);
    }
312689
def on(hook_type, state_or_event_name = nil, async = nil, &callback)
      sync_exclusive do
        if state_or_event_name.nil?
          state_or_event_name = HookEvent.any_state_or_event(hook_type)
        end
        async = false if async.nil?
        ensure_valid_callback_name!(hook_type, state_or_event_name)
        callback.extend(Async) if async == :async
        hooks.register(hook_type, state_or_event_name, callback)
      end
    end
817625
def next_reg_use( type , extra = {} )
      int = @symbol[1,3].to_i
      raise "No more registers #{self}" if int > 11
      sym = "r#{int + 1}".to_sym
      RegisterValue.new( sym , type, extra)
    end
572668
def register(origin, target, &block)
      raise(ArgumentError, 'block is required') unless block_given?

      @mutex.synchronize do
        @coercions[origin][target] = Coercion.new(origin, target, &block)
      end
    end
1101567
synchronized void addBlock(Block block) {
    if (!isInitialized()) {
      return;
    }
    
    BlockScanInfo info = blockMap.get(block);
    if ( info != null ) {
      LOG.warn("Adding an already existing block " + block);
      delBlockInfo(info);
    }
    
    info = new BlockScanInfo(block);    
    info.lastScanTime = getNewBlockScanTime();
    
    addBlockInfo(info);
    adjustThrottler();
  }
753275
def register(self, event, fn):
        

        # TODO: Can we check the method signature?
        self._handler_dict.setdefault(event, [])
        if fn not in self._handler_dict[event]:
            self._handler_dict[event].append(fn)
275913
public synchronized EventBus once(Class<? extends EventObject> eventType, OnceEventListenerBase listener) {
        if (null != onceBus) {
            onceBus.bind(eventType, listener);
        } else {
            bind(eventType, listener);
        }
        return this;
    }
58613
def initialize(self):
        
        super(Block, self).initialize()
        if self.block:
            self.block.parent.insert_children(self.block, self.children)