@smartface/smartface.emulator
Advanced tools
Comparing version
44
main.js
@@ -6,3 +6,3 @@ var SMFC_WS; | ||
'ui', 'commands', 'menus', 'proc', 'c9', 'layout', | ||
'dialog.error', 'fs', "Plugin", "jquery" | ||
'dialog.error', 'fs', "Plugin", "jquery", 'smf.updater' | ||
]; | ||
@@ -26,2 +26,3 @@ main.provides = ["smf.emulator"]; | ||
var jquery = imports.jquery.jquery; | ||
var smfUpdater = imports['smf.updater']; | ||
var $ = jquery; | ||
@@ -49,2 +50,3 @@ var emit = plugin.getEmitter(); | ||
}; | ||
var IS_UPDATER_IN_PROGRESS = true; | ||
@@ -70,2 +72,7 @@ ui.insertCss(require("text!./emulator.less"), staticPrefix, plugin); | ||
smfUpdater.once('smf.updater:finished', function() { | ||
IS_UPDATER_IN_PROGRESS = false; | ||
$('.c9-label:contains("Run on device")').parent().removeClass('smf-btn--disabled'); | ||
}); | ||
function show() { | ||
@@ -190,3 +197,3 @@ draw(); | ||
isAvailable: function() { | ||
return true; | ||
return !IS_UPDATER_IN_PROGRESS; | ||
}, | ||
@@ -202,33 +209,5 @@ exec: function() { | ||
commands.addCommand({ | ||
name: "smf.emulator.testProcStdin", | ||
isAvailable: function() { | ||
return true; | ||
}, | ||
exec: function() { | ||
proc.spawn("smartface-c9", { | ||
args: ['--command', 'connectToEmulator'], | ||
cwd: c9.workspaceDir, | ||
}, function(err, process) { | ||
if (err) throw err; | ||
process.stdin.write('hello world, sending from browser'); | ||
process.stdout.on("data", function(chunk) { | ||
if (CONSTANTS.logToConsole) { | ||
console.log('data, from node', chunk); | ||
} | ||
setTimeout(function() { | ||
process.stdin.write('received message from Node.js, sending this back'); | ||
}, 1000); | ||
}); | ||
process.stderr.on("data", function(chunk) { | ||
console.log(chunk); | ||
dialogError(chunk); | ||
}); | ||
}); | ||
} | ||
}, plugin); | ||
commands.addCommand({ | ||
name: "smf.emulator.initDispatcher", | ||
isAvailable: function() { | ||
return true; | ||
return !IS_UPDATER_IN_PROGRESS; | ||
}, | ||
@@ -271,3 +250,3 @@ exec: function() { | ||
isAvailable: function() { | ||
return true; | ||
return !IS_UPDATER_IN_PROGRESS; | ||
}, | ||
@@ -325,2 +304,3 @@ exec: function() { | ||
}), 999, plugin); | ||
$('.c9-label:contains("Run on device")').parent().addClass('smf-btn--disabled'); | ||
addCommand(); | ||
@@ -327,0 +307,0 @@ } |
{ | ||
"name": "@smartface/smartface.emulator", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "SmartfaceCloud Emulator", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
82434
-1.63%12
-7.69%410
-12.58%