V1.0
This commit is contained in:
commit
8ff1cdbd15
8
hourglass.iml
Normal file
8
hourglass.iml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="GENERAL_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
18
src/index.js
Normal file
18
src/index.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
const notifier = require('node-notifier');
|
||||||
|
const cron = require('node-cron');
|
||||||
|
const dayjs = require('dayjs');
|
||||||
|
|
||||||
|
// 定义整点触发的任务
|
||||||
|
cron.schedule('0 * * * *', () => {
|
||||||
|
// 获取当前时间
|
||||||
|
const currentDate = dayjs();
|
||||||
|
const date = currentDate.format('YYYYMMDD');
|
||||||
|
const time = currentDate.format('HH:mm');
|
||||||
|
|
||||||
|
notifier.notify({
|
||||||
|
title: '整点报时',
|
||||||
|
subtitle : "当前日期 " + date,
|
||||||
|
message: '当前时间 ' + time,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user