小编bsh*_*haw的帖子

在类构造函数中"未捕获的ReferenceError:未定义"

我正在玩JavaScript/ES6中的新东西.我得到了Uncaught ReferenceError: this is not defined(...) player.js:5我的代码.据我所知,这里没有错误!这是一个错误吗?任何解决方法?

的index.html

<html>
    <head>
        <script type="text/javascript" src="js/entity.js"></script>
        <script type="text/javascript" src="js/player.js"></script>
        <link href="css/style.css" rel="stylesheet" type="text/css">
        <title>Test</title>
    </head>
    <body>
        <canvas id="screen" width=500 height=500></canvas>
        <script type="text/javascript">initialize();</script>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

entity.js

"use strict";

class Entity {
    constructor() {
        console.log("Entity");
    }
}
Run Code Online (Sandbox Code Playgroud)

player.js

"use strict";

class Player extends Entity {
    constructor() {
        console.log("Created"); // <- error here
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6

42
推荐指数
1
解决办法
2万
查看次数

退出非root用户的ssh后,如何保持Linux程序运行?

我搜索,搜索,坐在IRC一个星期,甚至与一个虔诚地与Linux对齐的朋友交谈,但我还没有得到一个可靠的答案.

我编写了一个shell脚本,一旦我登录到我的非root用户就会运行,并且基本上只运行"./myprogram&"而不引用.当我退出时,我的程序超时,我无法连接到它,直到我重新登录.在退出非root用户的SSH后,如何保持程序运行?

我很好奇是否必须在程序级别完成或者什么?如果这不属于这里我很抱歉,我不确定它在哪里是完全诚实的.

linux debian

2
推荐指数
1
解决办法
2636
查看次数

标签 统计

debian ×1

ecmascript-6 ×1

javascript ×1

linux ×1