javascript - ember.js 中的 proto() 是什么意思?
问题描述
谁能解释这一行中的 proto() 是什么意思?它来自余烬代码。
Client.Details.proto().set('isAdminUser',win.isAuthenticatedAdmin);
解决方案
它是 ember.js 用来初始化其原型的。
您可以深入了解其来源:
Class.proto = function() {
var superclass = Class.superclass;
if (superclass) { superclass.proto(); }
if (!wasApplied) {
wasApplied = true;
Class.PrototypeMixin.applyPartial(Class.prototype);
Ember.rewatch(Class.prototype); // setup watch chains if needed.
hasChains = !!meta(Class.prototype, false).chains; // avoid rewatch
}
return this.prototype;
};
推荐阅读
- google-apps-script - Insert value new cell
- php - 如何在 laravel 7 中使用查询生成器初始化表名
- oop - 如何强制 struct 中的所有文件像 OOP 中的构造函数一样填充?
- javascript - 由于 CSP,Angular 动画无法在 Firefox 上运行(在 polyfills.ts 中使用 web-animations-js)
- python - 模板 django 中的多对多对象访问
- python - 在 Windows 上为 Django 启动开发服务器
- kubernetes - kops k8s cluster Kubectl 命令超时问题
- python - 如何使用 python web 抓取在这个 html 中获取公司名称?
- c++ - 在光线追踪中实现反射的问题
- java - 应为 BEGIN_OBJECT,但在第 5 行第 1 列路径 $ 处为字符串。我收到此错误,结果发现任何解决方案都不起作用