<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 文件中的常量?

      时间:2024-04-19

            <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 文件中的常量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:JavaScript 中的 const:何时使用它,是否有必要? 下一篇:ECMAScript 2015:for 循环中的 const

                相关文章

                    <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>