小编run*_*red的帖子

是不是弃用了`route.transitionTo`?

Ember记录了一个transitionTo已被弃用的警告transitionToRoute.但是,目前ember route.transitionTocontroller.transitionTo.只有controller.transitionToAPI和源代码中的弃用通知.

route.transitionTo被弃用的通知是一个错误,还是转换为的惯用方法this.controllerFor( routename ).transitionToRoute().

答案:没有弃权

原来,我有一个混合使用this.transitionTo,应该只涉及路线,但在控制器中使用,这使得更难注意到.

javascript routes deprecated ember.js

7
推荐指数
1
解决办法
1066
查看次数

Redis 无报错瞬间崩溃

我的虚拟机上安装了 redis,但我已经有一段时间没有使用它了。(上次我使用它,它确实有效,但现在不起作用......那段时间(大约一个月)没有任何变化)。不用说我很困惑,但我会发布尽可能多的信息。

$ redis-server

服务器启动,但抛出有关过度使用内存设置为 0 的警告。我在虚拟机上,因此如果我愿意,我无法将此设置从 0 更改为 1,但出于我的目的,我无论如何也不想这样做。不过,我已经编写了一个自定义redis.config文件,我希望它使用该文件(并且我过去使用过该文件),因此使用默认配置文件启动它对我没有多大好处。让我们再试一次。

$ redis-server redis.config
$
Run Code Online (Sandbox Code Playgroud)

没有什么。安静。没有错误信息,只是没有启动。

$ nohup redis-server redis.config > nohup.out&

我得到了一个进程 ID,但随后$ ps我看到该进程被列为stop并很快消失。同样,没有错误,nohup.out 和 redis 日志文件中都没有输出。下面是我正在使用的 redis.config (没有注释以使其简短)

daemonize yes
pidfile [my-user-account-path]/redis/redis.pid
port 0
bind 127.0.0.1
unixsocket [my-user-account-path]/tmp/redis.sock
unixsocketperm 770
timeout 10
tcp-keepalive 60
loglevel warning
logfile [my-user-account-path]/redis/logs/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error no
rdbcompression no
rdbchecksum no
dbfilename dump.rdb
dir [my-user-account-path]/redis/db
slave-serve-stale-data yes
slave-priority 100 …
Run Code Online (Sandbox Code Playgroud)

redis

5
推荐指数
1
解决办法
5629
查看次数

ember-cli App.get/App.set throw undefined

我正在将基于全局变量的实时Ember应用程序转换为使用ember-cli的基于es6的应用程序.在我的应用程序中,我需要经常了解当前的路线.在全局版本中,我正在这样做.

全球模式

var MyApp = Ember.Application.create({
    currentRoute : ''
});

MyApp.Route = Ember.Route.extend({
    actions : {
        didTransition : function () {
            MyApp.set('currentRoute', this);
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

然后,我可以MyApp.get('currentRoute')在我的会话或离线控制器中确定在发生某些事件时如何/在何处转换.

使用ember-cli时,我导入应用程序以便能够从必要的控制器中引用它.

import MyApp from "../app";
Run Code Online (Sandbox Code Playgroud)

但事实证明MyApp.currentRoute,MyApp.getMyApp.set都是不确定的.

我的一部分认为这是ember-cli中的一个错误,即应用程序实例不再绑定getter和setter.我的一部分意识到将应用程序实例存储在一起并不是一个很好的做法.

我可以解决这个问题,通过转换的所有实例MyApp.get,并MyApp.setEmber.get(MyApp, ...)Ember.set(MyApp, ...)分别,但我想我会先问这里,因为这似乎要么是与Ember,CLI或其他什么东西的问题,其中有达到什么更好的推荐方式我需要.

ember.js ecmascript-6 ember-cli

3
推荐指数
1
解决办法
904
查看次数