我打算使用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)
但是,如果来自客户端的用户决定将约会更改为其他日期,如何才能取消该特定作业?
在此先感谢您的帮助!
我正面临着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)