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

推荐订阅源

博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
Google Online Security Blog
Google Online Security Blog
Engineering at Meta
Engineering at Meta
U
Unit 42
Security Latest
Security Latest
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
D
Docker
T
Tailwind CSS Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
云风的 BLOG
云风的 BLOG
Hugging Face - Blog
Hugging Face - Blog
M
MIT News - Artificial intelligence
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
S
Security Affairs
T
The Exploit Database - CXSecurity.com
S
SegmentFault 最新的问题
N
News and Events Feed by Topic
The GitHub Blog
The GitHub Blog
Apple Machine Learning Research
Apple Machine Learning Research
S
Securelist
IT之家
IT之家
P
Palo Alto Networks Blog
D
DataBreaches.Net
Help Net Security
Help Net Security
N
Netflix TechBlog - Medium
B
Blog RSS Feed
AWS News Blog
AWS News Blog
Scott Helme
Scott Helme
爱范儿
爱范儿
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
I
Intezer
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
Microsoft Security Blog
Microsoft Security Blog
人人都是产品经理
人人都是产品经理
G
GRAHAM CLULEY
N
News | PayPal Newsroom
博客园 - 三生石上(FineUI控件)
A
Arctic Wolf
F
Fortinet All Blogs
The Register - Security
The Register - Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 【当耐特】

博客园 - 追萝驴

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赋值是写死的,但实际情况很可能是根据不同的条件动态赋值,这时候这个特性如果不留意,就会很坑人。