mcquery.js Version 0.1.0 DESCRIPTION mcquery.js is used to check the stock status of McPro Roc3 discs in the Innova Pro Shop. USAGE 1.) Install nodejs from nodejs.org and link the node and npm bin files to your $PATH environment variable. 2.) cd to the directory where mcquery.js is located. 3.) Type "npm install" to install program dependencies (twilio, request, cheerio). 4.) Type "node mcquery.js" to run the program. This will spit out the availability status to the console every 30 seconds by default - this default can be changed in the loop() function by removing the "3000" and replacing with the appropriaten umber of milliseconds. Once the availability changes to "availability in-stock," a text is sent to the phone number referenced in the sendAlert() function. NOTES 1.) The mcquery function checks Innova's Pro Shop for the status of the McPro Roc3 It uses the external "request" module with a URL and callback function as parameters. 2.) rocquest is the callback function for mcquery (2nd parameter). This function uses the external "cheerio" module to do JQuery HTML DOM parsing to find the paragraph with the availability status (in-stock or out-of-stock). 3.) The status variable is a global variable that is modified by rocquest and is a string that either says "availability in-stock " or "availability out-of-stock". 4.) The status is set each time mcquery() is called. This is done periodically because the status will change at some point from "out-of-stock" to "in-stock". Therefore, mcquery needs to be called repeatedly in a loop. 5.) setInterval is the function that will call mcquery every n milliseconds. n is set to 30000 milliseconds (30 seconds) by default. It will need to be cleared when the status no longer requires updating (i.e., the discis in stock). 6.) loop will be the function that acts as a wrapper for setInterval calling mcquery. As the name implies, it is a loop which will run until it has served its purpose. 7.) clearInterval is the function that will stop setInterval from repeatedly running mcquery. It takes only one parameter, in this case "loop". 8.) sendAlert is the function which will send a text message to me (you?) once the status is set to "in-stock". It only needs to be called once, right after the loop is stopped with clearInterval.