Closed MitiProject closed 6 years ago
Hello, I'm trying to use on() function, I send and receive data, but the .on([...]) doesn't work.
I set a breakpoint on line 11, but the debbuger never stops in that line.
My code:
var app = require("application"); var platform = require("platform"); var color = require("color"); var gestures = require("ui/gestures"); var labelModule = require("ui/label"); var SocketIO = require("nativescript-socketio").SocketIO; var socketIO = new SocketIO("http://192.168.1.9:9000", []); var dialogs = require("ui/dialogs"); socketIO.on("send command", function(data) { console.log(data); // This is line 11 }); socketIO.connect(); function dialogs2() { dialogs .action({ message: "Set up drunki", cancelButtonText: "Cancel", actions: ["Send Calibrate request"] }) .then(function(r) { console.log(socketIO.connected); if (socketIO.connected === false) return; socketIO.emit("send command", { message: "a" }); //Line 25 setFullScreen(); }); } // Event handler for Page "loaded" event attached in main-page.xml function pageLoaded(args) { if (app.android && platform.device.sdkVersion >= "21") setFullScreen(); } function setFullScreen() { var View = android.view.View; var window = app.android.startActivity.getWindow(); window.setStatusBarColor(0x000000); var decorView = window.getDecorView(); decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | // hide nav bar View.SYSTEM_UI_FLAG_FULLSCREEN | // hide status bar View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY ); } // Exports exports.pageLoaded = pageLoaded; exports.dialogs = dialogs2;
Hello, I'm trying to use on() function, I send and receive data, but the .on([...]) doesn't work.
I set a breakpoint on line 11, but the debbuger never stops in that line.
My code: