jshint抱怨:“Ember”没有定义 [英] jshint complains: 'Ember' is not defined

查看:133
本文介绍了jshint抱怨:“Ember”没有定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标准的 Ember main.js 文件,其开头如下:

I have a standard Ember main.js file, which starts like this:

this.App = Ember.Application.create({
    LOG_TRANSITIONS: true,
    VERSION: '1.0.0',
    ready: function () {
        console.log('App version: ' + App.VERSION + ' is ready.');
    }
});

运行这个通过 jshint 抱怨Ember不被定义,这在服务器中的这个特定文件是正确的,在部署阶段。因此,显示了许多错误消息。

Running this through jshint complains about Ember not being defined, which is true for this particular file in the server, during the deployment phase. Because of this, lots of error messages are shown.

Ember 在浏览器中由脚本标签 index.html

<script src="scripts/vendor/ember-1.0.0-rc.2.js"></script>

如何告诉 jshint Ember

推荐答案

以下应该做到:

/*global Ember */
this.App = Ember.Application.create({
    LOG_TRANSITIONS: true,
    VERSION: '1.0.0',
    ready: function () {
        console.log('App version: ' + App.VERSION + ' is ready.');
    }
});

JS提示文件

这篇关于jshint抱怨:“Ember”没有定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆