Download code/validation/JavaScript/0034815_device.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.68 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/validation/JavaScript/0034815_device.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/code/validation/JavaScript/0034815_device.js
-
curl -L -o 0034815_device.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/validation/JavaScript/0034815_device.js
1.68 kB
| (function() { | |
| var Device, FakeDevice; | |
| Device = (function() { | |
| function Device(ip, port) { | |
| this.ip = ip; | |
| this.port = port; | |
| } | |
| Device.prototype.getBusinessMusics = function() { | |
| return this.get("http://" + this.ip + ":" + this.port + "/bm", function() {}); | |
| }; | |
| Device.prototype.setLevel = function(id, level) { | |
| return this.put("http://" + this.ip + ":" + this.port + "/bm/" + id, function() {}); | |
| }; | |
| return Device; | |
| })(); | |
| FakeDevice = (function() { | |
| function FakeDevice(ip, port) { | |
| this.ip = ip; | |
| this.port = port; | |
| this.programs = [ | |
| { | |
| id: 1, | |
| name: "Program 1", | |
| zones: [1, 2, 3] | |
| }, { | |
| id: 2, | |
| name: "Program 1", | |
| zones: [] | |
| }, { | |
| id: 3, | |
| name: "Program 1", | |
| zones: [100] | |
| }, { | |
| id: 4, | |
| name: "Program 1", | |
| zones: [] | |
| } | |
| ]; | |
| } | |
| FakeDevice.prototype.getBusinessMusics = function(success) { | |
| return success(this.programs); | |
| }; | |
| FakeDevice.prototype.setLevel = function(id, level) { | |
| console.log("Set level " + level + " to device " + id); | |
| return this.programs[0]; | |
| }; | |
| FakeDevice.prototype.setZones = function(id, zones) { | |
| var text; | |
| text = "This program is currently not assigned to any zone!"; | |
| if (zones.length > 0) { | |
| return $(".program-container[data-id=" + id + "] .program-zones").html("This zone is currently assigned to " + zones.length + " zones: " + (zones.sort().join(", "))); | |
| } | |
| }; | |
| return FakeDevice; | |
| })(); | |
| window.FakeDevice = FakeDevice; | |
| }).call(this); | |