Skip to content

Instantly share code, notes, and snippets.

@jakebathman
Created December 30, 2018 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakebathman/b4e35565b29d11f9cf2bcf1ffc0f346d to your computer and use it in GitHub Desktop.
Save jakebathman/b4e35565b29d11f9cf2bcf1ffc0f346d to your computer and use it in GitHub Desktop.
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