【发布时间】:2017-03-21 22:19:09
【问题描述】:
runNow 方法here 有文档:
/**
* Executes this callback, on the current thread, right now, blocking until complete.
*
* In most cases, this type is passed to scalajs-react such that you don't need to call this method yourself.
*
* Exceptions will not be caught. Use [[attempt]] to catch thrown exceptions.
*/
这有点含糊,引出了四个问题:
- 什么时候我不应该打电话给
runNow()?为什么 ? - 是不是我不应该(或不必)调用
runNow()的唯一情况是当我使用带有==>或-->的回调时(如here 所述)? (我猜这是真的)或者当框架为我调用runNow()时还有其他情况吗? - 什么时候允许我打电话给
runNow()?为什么? - 为什么不一直使用
runNow呢?这会导致任何问题吗?如果是,是什么?
我目前的理解是可以(甚至需要)从 scala-function that has been passed as a callback 调用 runNow() 到包装的原生 JS 反应组件。例如here。
但是我不确定。
有人可以澄清什么时候可以打电话,什么时候不可以打电话runNow() 吗?
【问题讨论】: