Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * View model for OctoPrint-Irene
- *
- * Author: robofred
- * License: AGPLv3
- */
- $(function() {
- function ireneViewModel(parameters) {
- var self = this;
- self.settings = parameters[0];
- self.servoCmd = ko.observable();
- self.cmdServo = function(element, event) {
- var newSpeed = event.servoCmd.value
- if(newSpeed) {
- console.log("hey kir2koon") // nothing happens in console
- self.servoCmd(newSpeed)
- OctoPrint.simpleApiCommand('irene', 'update_speed', {'servoCmd': newSpeed})
- }
- }
- self.onBeforeBinding = function() {
- }
- self.onDataUpdaterPluginMessage = function(plugin, data) {
- if(plugin != 'irene') { return }
- if(data.hasOwnProperty('servoCmd')) {
- self.servoCmd(data.servoCmd)
- }
- }
- }
- OCTOPRINT_VIEWMODELS.push({
- construct: ireneViewModel,
- dependencies: ["settingsViewModel"],
- elements: ["#sidebar_plugin_irene"]
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement