$.getJSON(\'https://api.twitch.tv/kraken/channels/\' + SLoppierKitty7, function(channel) {
if (channel[\"stream\"] == null) {
var live =\"no\"
} else {
Yes, it does. jQuery expects the 'window' to be there, which is normally a browser-only object. As such, the window needs to be simulated. That is what jsdom does.
After including jsdom (npm install jsdom
):
// Load jsdom, and create a window.
var jsdom = require("jsdom").jsdom;
var doc = jsdom();
var window = doc.defaultView;
// Load jQuery with the simulated jsdom window.
$ = require('jquery')(window);
See the jsdom documentation for more information: https://www.npmjs.com/package/jsdom