- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我通过{"silent":true}
在 Backbone 模型中设置属性时,为什么不只是抑制 change:attribute
事件?下次更改属性时触发该事件有什么好处?
更新
Backbone 0.9.10 改变了传递行为 { "silent": true }
.从变更日志:
Passing
{silent:true}
on change will no longer delay individual "change:attr" events, instead they are silenced entirely.
最佳答案
这也让我困惑了一段时间。
原因是 {silent:true} 确实 不是 意思是“一切正常,但不要触发事件”。
从@jashkenas 的各种评论和答案来看,它的意思似乎是“只需更改属性值(并将其添加到 'changedAttributes' 哈希中),但将所有其他“与更改相关”的事件推迟到以后”。
'silent' 不会阻止 change
对于那个/那些属性的事件,它只是将“公告”排队,直到下一个 change
事件被触发。
所以,它可能更好地命名为 defer
.
相关信息:
https://github.com/documentcloud/backbone/pull/850
the point of a "silent" change is that it isn't considered a change from the models point of view. Later, when the change actually occurs, you get the full difference all at once.
Because the point of silent changes is that you're allowed to twiddle with the internal state of your model, temporarily, without actually making a change. Later, when the attribute actually changes, the validation runs and events are emitted. It wouldn't make sense to emit an error event when making a silent change.
silent:true
抑制
change:attr
事件完全 - 不仅仅是延迟它们。
关于backbone.js - 在 Backbone.js 中,为什么静默更改最终会触发更改事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10030139/
我对 JavaScript/jQuery 和 Web 开发有点陌生。我当前的项目是为网站建立一个小型聊天室。一切正常,但我有一个问题: 如何将数据从客户端传输到服务器并返回(例如通过 javascri
warn 4 与 print STDERR 4 有何不同? perl -e 'local *STDERR; warn 4' (输出仍然转到 STDERR ) perl -e 'local *STDER
所以在面对可怕的javax.faces.application.ViewExpiredException之后,我不得不在互联网上寻找合适的解决方案。幸运的是,这些解决方案随时可用,我继续采用了 Omn
我正在尝试使用 Spring Modules 项目中的声明性缓存。 它不起作用,即。似乎没有任何东西被缓存。 这是我的配置:
我正在实现以下教程:Speech To Text 我正在使用 AVAudioEngine 和 SFSpeechRecognizer 录制音频实现语音到文本。此处教程使用以下方法将语音引导至文本一个开始
我有一个文本(有多行),需要将其放入 wxPython TextCtrl 中。 问题是其中一些行包含无法打印的字符。 我的解决方案是使用 AppendText,并 try catch 有问题的行。 当
有没有办法直接从 Angular/客户端应用程序使用“用户名”和“密码”登录? 例如像这样的东西? Keycloak.init({username: 'guest', password: 'abc'}
我这样执行 GET 请求: http://www.smurf.com/path/?var=val 这显示在用户的 URL 中。我当然在几乎每个主要网站上都看到了这一点。 但我只是好奇是否有办法绕过它。
假设我有两个相互硬链接(hard link)的文件: -rw-rw-r-- 2 mparrott grp 5 Jul 28 09:38 bar -rw-rw-r-- 2 mparrott grp 5
我想在 android 4+ 中以编程方式(直接)添加日历事件。这可以在模拟器上测试吗?我没有安卓手机。一些示例代码将不胜感激。我阅读了 android 开发人员的日历提供程序,但我很困惑。如何将事件
我正在向我的工作簿添加一个新工作表 Application.ScreenUpdating = False SheetExists = False For Each WS In Worksheets
我正在 Excel 中的 VBA 中进行一些网页解析;我是 MSHTML 来下载和解析网页。但是,在某些站点上,会弹出一个对话框。它工作正常;但是,我想知道是否有办法禁用它或可能绕过它。感谢您的时间。
有没有办法使用谷歌的 firebase 发送一个无声的 APNS? 似乎如果应用程序在后台,它总是会向用户显示通知。 谢谢? 最佳答案 您可以使用 FCM 服务器 API 发送静默 APNS 消息 h
我有一个 Powershell 脚本来放松机器上的执行策略,本质上是运行: Set-ExecutionPolicy Unrestricted -Force 由于 ExecutionPolicy 在机器
我有一个 Powershell 脚本,用于将我们的生产数据库复制到我们的测试环境以及相关的清理事件。我想清理为用户输出到控制台的信息,但在清理从 Az.sql 命令中收到的错误消息时遇到了问题。 我的
这是我当前的 Facebook 应用程序登录流程(有关解释,请参阅 this answer)。 logout() 和 login() 是在用户注销或登录时呈现页面的虚拟函数。 window.fbAsy
我有一个 React Native 应用程序,我正在尝试将静默的 iOS 推送通知发送到 JavaScript 中的处理程序。 我看到的行为是 AppDelegate 中的 didReceiveRem
我正在使用数据通知来更新我的应用程序状态,它在 Android 上运行完美,但我无法在 IOS 上接收到任何数据消息,甚至没有触发 onMessage 监听器。 我正在使用这些: firebase_c
我知道较新的 GCC 版本引入了可能错误的字符串操作“stringop-truncation”的警告 这是我可以轻松触发此警告的示例代码: $ cat strncpy-warning.cxx #inc
标题基本上描述了它。 我检查过的事情: 验证了远程 Powershell session 中的用户名(以确保事情正在以我期望的权限执行) 检查了所描述文件的权限。预期用户拥有文件的完全控制权 删除了
我是一名优秀的程序员,十分优秀!