4

在路由器 API 的 v1 中,您可以设置此标志:

App.Router = Ember.Router.extend({
  enableLogging: true
});

并且路由器会将状态更改记录到console.log,这有助于调试。这似乎不再起作用了——有谁知道是否有一个新的等价于这个标志?

4

2 回答 2

9

1bf0df4提交以来:

App = Ember.Application.create({
  LOG_TRANSITIONS: true
});
于 2013-01-08T16:16:37.363 回答
0

据我所知,我认为这还没有在 master 分支中解决:但是我在源代码中找到了相关的注释:

/* For me this comment starts on line 23202 on build v1.0.0-pre.2-233-g2db13c3

In addition to creating your application's router, `Ember.Application` is
also responsible for telling the router when to start routing.

By default, the router will begin trying to translate the current URL into
application state once the browser emits the `DOMContentReady` event. If you
need to defer routing, you can call the application's `deferReadiness()`
method. Once routing can begin, call the `advanceReadiness()` method.

If there is any setup required before routing begins, you can implement a
`ready()` method on your app that will be invoked immediately before routing
begins:

window.App = Ember.Application.create({
  ready: function() {
    this.set('router.enableLogging', true);
  }
});

*/

请注意,此注释实际上是在 master 分支的源代码中,该分支已合并到新的路由更改中。我不得不得出结论,这是一个错误,并且可能会在不久的将来解决(希望如此)。

于 2013-01-02T02:06:48.630 回答