Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Test file for createAlarm function PR for Shortcuts JS
// Only used to create the .shortcut file
const fs = require('fs');
const {
buildShortcut,
} = require('./');
const {
comment,
createAlarm,
} = require('./actions');
// Define our list of actions
const actions = [
comment({
text: 'This will create an 8:42 AM alarm, repeating every S,M,W,F,S. This is a companion to PR joshfarrant/shortcuts-js#55',
}),
createAlarm({
label: 'Repeating test alarm',
time: '8:42 AM',
repeat: ['Sunday', 'Monday', 'Wednesday', 'Friday', 'Saturday'],
}),
];
// Generate the Shortcut data
const shortcut = buildShortcut(actions);
// Write the Shortcut to a file in the current directory
fs.writeFile('Test Create Alarm.shortcut', shortcut, (err) => {
if (err) {
console.error('Something went wrong :(', err);
return;
}
console.log('Shortcut created!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.