I have been investigating how various module concepts can be applied within NodeJS and browser applications using the the NodeJS require (obviously in NodeJS apps) and RequireJS for the web browser environment.

我一直在研究在node . js和浏览器应用程序中使用NodeJS需要(显然是在NodeJS应用程序中)以及web浏览器环境的RequireJS中,如何应用各种模块概念。

It then dawned on me that some modules may be useful for use by both the client and server applications and thus could be reused.

然后我意识到,有些模块可能对客户端和服务器应用程序都有用,因此可以重用。

How can modules be developed so that they are compatible with both of these environments?

如何开发模块,使它们与这两个环境兼容?

One is synchronous and one asynchronous. My first thought was to utilise the asynchronous syntax and then to define a custom module for NodeJS which simply invokes the asynchronous callback, synchronously. But how would the RequireJS-emulator be included into the cross-environment module without first using the NodeJS synchronous callback?

一个是同步的,一个是异步的。我的第一个想法是使用异步语法,然后为NodeJS定义一个自定义模块,该模块只需同步调用异步回调。但是,如果不首先使用NodeJS同步回调,如何将requirejs -仿真器包含到跨环境模块中呢?

3 个解决方案

#1


10

See this post : Bridging the module gap between Node.js and browsers

参见本文:连接节点之间的模块间隙。js和浏览器

更多相关文章

  1. 制作一个基本的angularjs应用程序对我不起作用,我也不知道为什么
  2. 如何更模块化地编写jQuery代码?
  3. Emberjs应用程序加载除Index之外的所有路由
  4. 在Android上使用离子崩溃而不是ios构建的混合应用程序
  5. RequireJS中的命名模块与未命名模块
  6. Node.js嬉皮API测试模块安装
  7. Python和Visual Studio需要安装Node.js模块(Superfeedr Node.js包
  8. 没有'Access-Control-Allow-Origin'反应表达docker应用程序
  9. 如何测试从实时网站提取数据的AJAX应用程序?

随机推荐

  1. Android(Java):Android ListView checkbo
  2. 第六章:基本控件
  3. eclipse android椤圭洰杞琣ndroid studio
  4. Error inflating class android.support.
  5. Android 复制到剪贴板
  6. Android中findViewById返回为空null的快
  7. Android Studio打包cordova项目过程中遇
  8. eclipse创建android项目,无法正常预览布局
  9. android之ION内存管理器(1)-- 简介
  10. android:ellipsize