Tag: 实现

Node.js中分阶段执行recursion循环

我是一般的Node.js和asynchronous编程的新手,我有一个问题。 我需要在recursion循环中连续工作的服务器,这些步骤将被一致地执行,并且每个阶段应该包括通过websotskets(这已经被理解)的asynchronous接收数据,或者在计时器到期时进入下一阶段。 我意识到,这不是一个小任务,而是如何实现它,图书馆可以提供什么帮助? 我试图理解Step.js和Node.js事件,这是我需要什么? 如果我写了所有这一切同步: //CODE FOR STACKOVERFLOW var previous_round = 'qwerty';// this is string, selected in previous cycle var round_users = users;// 'users' is array of soceket.id all connected users and here a put them into new array 'round_users' with sockets for current cycle io.sockets.emit('users_round', { number: round_users.length }); // send to users information […]

如何在nodejs中使用MaterializeCSS?

我已经运行了以下命令: npm install materialize-css –save npm install hammerjs –save npm install jquery –save 然后在我的app.js , var materialize = require('materialize-css'); 但是当我运行npm start时,我会一直得到相同的错误: /Users/myname/code/websites/n-website/node_modules/materialize-css/bin/materialize.js:1 eof require?$=require("jquery"):$}jQuery.easing.jswing=jQuery.easing.swing,jQu ^ TypeError: Cannot read property 'swing' of undefined at Object.<anonymous> (/Users/nyname/code/websites/n-website/node_modules/materialize-css/bin/materialize.js:1:195) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.<anonymous> […]