public IJsNavateInvokeHandle CreateHandle(JsNativeInvokeContext context) { if (HandleCreaterMap.ContainsKey(context.MapInfo.Action)) { return(HandleCreaterMap[context.MapInfo.Action](context)); } throw new InvalidOperationException($"处理器{context.MapInfo.Action}无法创建,该处理器构建器未在工厂注册"); }
public void RegisterHandleCreater(MapAction action, Func <JsNativeInvokeContext, IJsNavateInvokeHandle> creater) { if (HandleCreaterMap.ContainsKey(action)) { throw new InvalidOperationException($"处理器{action}构建器无法重复注册,工厂已经存在该处理器构建器注册"); } HandleCreaterMap.Add(action, creater); }