小编Sha*_*han的帖子

设置后取消节点计划事件

我打算使用node-schedule为约会提醒设置推送通知,如下所示:

var schedule = require('node-schedule');
var date = req.body.date;   // Date for reminder from client request 
var j = schedule.scheduleJob(date, function(){
    // Send push notification
});
Run Code Online (Sandbox Code Playgroud)

现在我知道你可以通过调用cancel()来取消事件:

j.cancel()
Run Code Online (Sandbox Code Playgroud)

但是,如果来自客户端的用户决定将约会更改为其他日期,如何才能取消该特定作业?

在此先感谢您的帮助!

cron node.js

10
推荐指数
1
解决办法
6848
查看次数

SpheroJS命令同步响应丢失了OSX

我正面临着spherojs npm包的问题,​​一旦发出命令,OSX就无法从BB8获得响应:

Unhandled rejection Error: Command sync response was lost.
    at Sphero.handler (/Users/shah/projects/node/ai8/node_modules/sphero/lib/sphero.js:252:21)
From previous event:
    at Sphero.command (/Users/shah/projects/node/ai8/node_modules/sphero/lib/sphero.js:180:10)
    at Sphero.device.setRgbLed    (/Users/shah/projects/node/ai8/node_modules/sphero/lib/devices/sphero.js:369:12)
    at Sphero.device.color (/Users/shah/projects/node/ai8/node_modules/sphero/lib/devices/custom.js:168:19)
    at file:///Users/shah/projects/node/ai8/js/orb.js:7:7[0m
Run Code Online (Sandbox Code Playgroud)

我目前的环境是:

ProductName:    Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G31

node -v
v6.9.5

npm -v 
3.10.10

 system_profiler SPBluetoothDataType | sed -n "/Apple Bluetooth Software Version\:/,/Manufacturer\:/p" | tr -s "    [\n]" "[ ]" | sed "s:.*Address\: ::g" | sed "s: Manufacturer\:.*::g" | grep "[[:graph:]]"

80-E6-50-1B-50-31 Bluetooth Low Energy Supported: Yes Handoff Supported: Yes Instant Hot …
Run Code Online (Sandbox Code Playgroud)

node.js sphero

6
推荐指数
0
解决办法
142
查看次数

标签 统计

node.js ×2

cron ×1

sphero ×1