惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Spread Privacy
Spread Privacy
大猫的无限游戏
大猫的无限游戏
F
Fortinet All Blogs
M
MIT News - Artificial intelligence
G
Google Developers Blog
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Help Net Security
V
Visual Studio Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
TaoSecurity Blog
TaoSecurity Blog
Webroot Blog
Webroot Blog
Hugging Face - Blog
Hugging Face - Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
W
WeLiveSecurity
C
CERT Recently Published Vulnerability Notes
Y
Y Combinator Blog
S
Schneier on Security
Recent Announcements
Recent Announcements
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
宝玉的分享
宝玉的分享
T
Troy Hunt's Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
Microsoft Azure Blog
Microsoft Azure Blog
N
News and Events Feed by Topic
A
About on SuperTechFans
小众软件
小众软件
K
Kaspersky official blog
Help Net Security
Help Net Security
V2EX - 技术
V2EX - 技术
P
Proofpoint News Feed
S
Secure Thoughts
IT之家
IT之家
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
The Register - Security
The Register - Security
I
Intezer
NISL@THU
NISL@THU
GbyAI
GbyAI
P
Privacy & Cybersecurity Law Blog
T
Threatpost
C
Check Point Blog
Forbes - Security
Forbes - Security
C
Cisco Blogs
AI
AI
Recorded Future
Recorded Future
F
Full Disclosure

博客园 - 追萝驴

Nginx + Frp + Let'sEncrypt 泛域名证书 Devexpress XAF的前端优化策略 本页不但包含安全的内容,也包含不安全的内容。是否显示不安全的内容 WIF应用与ADFS 2.0配置实战(续):实现SSO WIF应用与ADFS 2.0配置实战 配置了主机头后访问站点持续要求输入身份凭证,之后401.1 IE持续崩溃备忘 Sharepoint 2010 备忘 APPDEV Sharepoint 2010 For Developers. 笔记 庆祝NH3 GA Released 兼思考两个问题的解决方案 - 追萝驴 WCF部署至IIS问题二则 WCF+Silverlight 异常处理 2 NHibernate: Batch Updates & Batch Inserts - 追萝驴 NHibernate: Session.Save 采用版本控制时无必要地自动Update版本字段的问题 WCF+Silverlight 异常处理 "Exception of type System.ExecutionEngineException was thrown" ExtJS: SuperBoxSelect supports single select mode [转]How to remove an assembly from the Cache if it is locked by Microsoft Installer Adding/removing fields and columns drag & drop bug's fix
Ext JS继承: 关于object, constructor和prototype
追萝驴 · 2010-05-25 · via 博客园 - 追萝驴

基本知识:object没有prototype;但object有constructor;constructor是function,所以constructor有prototype。那么原型继承的核心是什么呢?就是把object的constructor的prototype的属性复制到了此object上。

当然,实际情况要复杂得多,这里提到这些,是因为和Ext的一个方法有关:Ext.extend(parent, config);

其中值得关注的是config。例如这么写:

Ext.ns('Demo','Demo.Configuration');

Demo.Configuration.Sample1 = Ext.extend(Ext.Component, {

  name : '李东东',

  otherConfig : {}

  initComponent : function() {

    otherConfig = otherConfig || {sex: 'female'};

  }

});

上面的name和otherConfig属性,在new完第一个Demo.Configuration.Sample1对象之后,就会出现在Demo.Configuration.Sample1.constructor.prototype的属性之中。也就是说,在new 完第一个对象之后,再new其他的对象时,将会在初始时就自动带了和第一个对象一模一样的属性名值对,这个例子里是{sex : 'female'},注意是在最初始的状态就是这个值,而不再是想当然的到initComponent中才改变的{}了。例子中给otherConfig赋值是写死的,但实际情况很可能是根据不同的条件动态赋值,这时候这个特性如果不留意,就会很坑人。