WeexSDK之注册Handlers
先看代码:
+ (void)_registerDefaultHandlers
{
[self registerHandler:[WXResourceRequestHandlerDefaultImpl new] withProtocol:@protocol(WXResourceRequestHandler)];
[self registerHandler:[WXNavigationDefaultImpl new] withProtocol:@protocol(WXNavigationProtocol)];
[self registerHandler:[WXURLRewriteDefaultImpl new] withProtocol:@protocol(WXURLRewriteProtocol)]; }
WXSDKEngine中默认注册了3个Handler。
+ (void)registerHandler:(id)handler withProtocol:(Protocol *)protocol
{
WXAssert(handler && protocol, @"Fail to register the handler, please check if the parameters are correct !"); [WXHandlerFactory registerHandler:handler withProtocol:protocol];
}
WXSDKEngine会继续调用WXHandlerFactory的registerHandler:withProtocol:方法。
@interface WXHandlerFactory : NSObject @property (nonatomic, strong) WXThreadSafeMutableDictionary *handlers; + (void)registerHandler:(id)handler withProtocol:(Protocol *)protocol; + (id)handlerForProtocol:(Protocol *)protocol; + (NSDictionary *)handlerConfigs; @end
WXHandlerFactory也是一个单例,里面有一个线程安全的字典handlers,用来保存实例和Protocol名的映射表。

WeexSDK之注册Handlers的更多相关文章
- WeexSDK之注册Components
先来看一下注册Components的源码: + (void)_registerDefaultComponents { [self registerComponent:@"container& ...
- WeexSDK之注册Modules
注册Modules的流程和注册Components非常类似. + (void)_registerDefaultModules { [self registerModule:@"dom&quo ...
- WeexSDK源码分析(iOS)
0.从工作原理谈起 Weex 表面上是一个客户端技术,但实际上它串联起了从本地开发.云端部署到分发的整个链路.开发者首先可在本地像编写 web 页面一样编写一个 app 的界面,然后通过命令行工具将之 ...
- Python urllib2 模块学习笔记
2015.3.6 urllib2的使用方法大致如下 # 定制Handler处理函数 opener = urllib2.build_opener(ProxyHandler, HTTPHandler) ...
- LWP::UserAgent - Web user agent class Web 用户agent 类:
LWPUserAgent: LWP::UserAgent - Web user agent class Web 用户agent 类: 概述: require LWP::UserAgent; my $u ...
- Iris框架源码阅读和分析
iris包结构简介 iris包含了很多包,下面这些是分析过程中接触到的东西. 能力有限,多多包涵,欢迎联系QQ:2922530320 一起交流 context包包含: Context (接口) con ...
- SpringCloud解析之Zuul(一)
本文基于Spring Cloud Edgware.SR6,Zuul版本1.3.1,解析Zuul的请求拦截机制,让大家对Zuul的原理有个大概的认识和了解.如有不对的地方,欢迎指正. spring bo ...
- Node.js Express连接mysql完整的登陆注册系统(windows)
windows学习环境: node 版本: v0.10.35 express版本:4.10.0 mysql版本:5.6.21-log 第一部分:安装node .Express(win8系统 需要&qu ...
- Java Web之网上购物系统(注册、登录、浏览商品、添加购物车)
眼看就要期末了,我的专业课也迎来了第二次的期末作业---------<网上购物系统>.虽然老师的意图是在锻炼我们后台的能力,但是想着还是不利用网上的模板,准备自己写,以来别人写的静态页看不 ...
随机推荐
- Android APK反编译(一)
apk是安卓工程打包的最终形式,将apk安装到手机或者模拟器上就可以使用APP.反编译apk则是将该安卓工程的源码.资源文件等内容破解出来进行分析. 一.APK反编译基本原理 1.APK分析 apk文 ...
- python学习笔记(七)- 递归、python内置函数、random模块
1.函数的不固定参数: #参数不是必填的.没有限制参数的个数.返回参数组的元组 def syz(*args): #参数组,不限制参数个数 #‘args’参数的名字可以随便命名 print(args) ...
- cleos
[cleos] 1.在.bashrc中加入以下代码,方便直接使用 cleos,7777是nodeos端口,5555是keosd端口. alias cleos='docker exec -it eosi ...
- Java学习笔记(十六):this关键字
- JAVA企业级应用TOMCAT实战
1. Tomcat简介 原文链接:https://blog.oldboyedu.com/java-tomcat/ Tomcat是Apache软件基金会(Apache Software Foundati ...
- laravel简书(1)
Laravel的社区生态 中文社区(http://laravel-china.org) 5.4中文文档(http://d.laravel-china.org/docs/5.4) Laravel源码地址 ...
- python之运算符
运算符的定义 运算符用于执行程序代码运算,会针对一个以上操作数项目来进行运算. 运算符类型 .算数运算符 .比较运算符 .赋值运算符 .位运算符 .逻辑运算符 .成员运算符 7身份运算符 详情介绍 1 ...
- AutoCAD开发1---获取块属性
Private Sub CommandButton1_Click() Dim pEntity As AcadObject Dim pBlock As AcadBlockReference Dim pP ...
- c++ stl源码剖析学习笔记(二)iterator
ITERATOR 迭代器 template<class InputIterator,class T> InputIterator find(InputIterator first,Inpu ...
- python 根据字符串内数字排序
当我们使用python给一个由字符串组成的列表排序时,常常会排成这样 [‘10a’, ‘11b’, ‘1c’, ‘20d’, ‘21e’, ‘2f’] 这样的形式 ,然而我们想要 [ ‘1c’,‘2f ...