sencha touch 中的配置变量

发布于 2024-12-04 04:29:41 字数 208 浏览 4 评论 0原文

我想为我的 sencha touch 应用程序提供配置选项,例如基本 URL(以便进行 API 调用)。

当然,此配置应该位于部署时可编辑的文件中。

把这个放在哪里合适?数据存储?或者我应该在根目录的 config.js 文件中声明一个命名空间 MyApp.config 并在那里定义变量和函数?

谢谢

I would like to offer configuration options for my sencha touch application, for instance a base URL (in order to make API calls).

Of course, this configuration should be in a file editable at deployment time.

Where is the right place to put this? A data store? Or should I just declare a namespace MyApp.config in a config.js file at the root and define variables and functions there?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

病女 2024-12-11 04:29:41

好吧,我最终定义了一个 MyApp.config 命名空间并将我的东西放在那里

Well, I ended up defining a MyApp.config namespace and putting my stuff there

烂柯人 2024-12-11 04:29:41

我在index.php(它是index.html的替代品)中放置了一段简短的代码,它在数组中提供了必要的配置参数。

<script>
    my_settings={
        data:<?=$data?>,
    };
</script>

其他文件是静态的以加快加载时间。我的 app.js 可以很好地从全局 my_settings 中提取数据。

I have placed a short code in the index.php (which is replacement for index.html) which was providing necessary configuration arguments in an array.

<script>
    my_settings={
        data:<?=$data?>,
    };
</script>

Other files were static to speed up loading time. My app.js was pulling data from global my_settings just fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文