<legend id='9VNky'><style id='9VNky'><dir id='9VNky'><q id='9VNky'></q></dir></style></legend>

    <tfoot id='9VNky'></tfoot>

    1. <small id='9VNky'></small><noframes id='9VNky'>

    2. <i id='9VNky'><tr id='9VNky'><dt id='9VNky'><q id='9VNky'><span id='9VNky'><b id='9VNky'><form id='9VNky'><ins id='9VNky'></ins><ul id='9VNky'></ul><sub id='9VNky'></sub></form><legend id='9VNky'></legend><bdo id='9VNky'><pre id='9VNky'><center id='9VNky'></center></pre></bdo></b><th id='9VNky'></th></span></q></dt></tr></i><div id='9VNky'><tfoot id='9VNky'></tfoot><dl id='9VNky'><fieldset id='9VNky'></fieldset></dl></div>
        <bdo id='9VNky'></bdo><ul id='9VNky'></ul>

      如何访问 Meteor 的 lib/constants.js 文件中的常量?

      How can I access constants in the lib/constants.js file in Meteor?(如何访问 Meteor 的 lib/constants.js 文件中的常量?)

            <tbody id='WcfM7'></tbody>
          <tfoot id='WcfM7'></tfoot>
        • <legend id='WcfM7'><style id='WcfM7'><dir id='WcfM7'><q id='WcfM7'></q></dir></style></legend>
          1. <i id='WcfM7'><tr id='WcfM7'><dt id='WcfM7'><q id='WcfM7'><span id='WcfM7'><b id='WcfM7'><form id='WcfM7'><ins id='WcfM7'></ins><ul id='WcfM7'></ul><sub id='WcfM7'></sub></form><legend id='WcfM7'></legend><bdo id='WcfM7'><pre id='WcfM7'><center id='WcfM7'></center></pre></bdo></b><th id='WcfM7'></th></span></q></dt></tr></i><div id='WcfM7'><tfoot id='WcfM7'></tfoot><dl id='WcfM7'><fieldset id='WcfM7'></fieldset></dl></div>

            <small id='WcfM7'></small><noframes id='WcfM7'>

                <bdo id='WcfM7'></bdo><ul id='WcfM7'></ul>

                本文介绍了如何访问 Meteor 的 lib/constants.js 文件中的常量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我按照文档将常量放入 lib/constants.js 文件中.

                I followed the documentation to put the constants in the lib/constants.js file.

                问题:如何在我的客户端 htmljs 文件中访问这些常量?

                Question: How to access these constants in my client side html and js files?

                推荐答案

                您需要将它们设为全局变量,以便其他文件看到它们.

                You will need to make them global variables in order for other files to see them.

                /lib/constants.js

                THE_ANSWER = 42; // note the lack of var
                

                /client/some-other-file.js

                console.log(THE_ANSWER);
                

                <小时>

                咖啡脚本

                /lib/constants.coffee

                @THE_ANSWER = 42
                

                /client/some-other-file.coffee

                console.log THE_ANSWER
                

                这篇关于如何访问 Meteor 的 lib/constants.js 文件中的常量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                Ordinals in words javascript(javascript中的序数)
                getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)

                      <bdo id='N1s1c'></bdo><ul id='N1s1c'></ul>
                      <tfoot id='N1s1c'></tfoot>

                        <small id='N1s1c'></small><noframes id='N1s1c'>

                      1. <legend id='N1s1c'><style id='N1s1c'><dir id='N1s1c'><q id='N1s1c'></q></dir></style></legend>

                      2. <i id='N1s1c'><tr id='N1s1c'><dt id='N1s1c'><q id='N1s1c'><span id='N1s1c'><b id='N1s1c'><form id='N1s1c'><ins id='N1s1c'></ins><ul id='N1s1c'></ul><sub id='N1s1c'></sub></form><legend id='N1s1c'></legend><bdo id='N1s1c'><pre id='N1s1c'><center id='N1s1c'></center></pre></bdo></b><th id='N1s1c'></th></span></q></dt></tr></i><div id='N1s1c'><tfoot id='N1s1c'></tfoot><dl id='N1s1c'><fieldset id='N1s1c'></fieldset></dl></div>
                          <tbody id='N1s1c'></tbody>