示例#1
0
        // Registers a |handler| for the event with |eventName|. Supported event names: error, result. See corresponding
        // handler types above.
        public FunctionCall On(string eventName, Delegate handler)
        {
            ValidateHandler(eventName, handler);

            if (eventName == "result")
            {
                OnResult.Add(handler);
            }
            else if (eventName == "exception")
            {
                OnException.Add(handler);
            }
            else if (eventName == "error")
            {
                OnError += (CallErrorCallback)handler;
            }

            return(this);
        }