mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-07 11:34:05 +08:00
update files
This commit is contained in:
parent
4ab4f07b0f
commit
f34adf9270
@ -47,27 +47,26 @@ function scroll(xterm, parent){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var worker = new Worker('static/js/components/app-main/terminal-worker.js');
|
||||||
|
|
||||||
|
worker.onmessage = function (){
|
||||||
|
console.log(arguments);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createXTerm
|
* openXTerm
|
||||||
* @param name
|
* @param name
|
||||||
* @param xtermNode
|
|
||||||
*/
|
*/
|
||||||
function createXTerm(name, xtermNode){
|
function openXTerm(name){
|
||||||
var xterm;
|
worker.postMessage({ atcion: 'open', name: name });
|
||||||
var runtime = window.AppRuntime[name];
|
}
|
||||||
|
|
||||||
if (runtime) {
|
/**
|
||||||
xterm = runtime.xterm;
|
* closeXTerm
|
||||||
} else {
|
* @param name
|
||||||
xterm = new Terminal(80, 60, 60);
|
*/
|
||||||
|
function closeXTerm(name){
|
||||||
window.AppRuntime[name] = {
|
worker.postMessage({ atcion: 'close', name: name });
|
||||||
xterm: xterm
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
xtermNode.innerHTML = xterm.toString('html');
|
|
||||||
scroll(xterm, xtermNode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Vue.component('app-main', {
|
module.exports = Vue.component('app-main', {
|
||||||
@ -110,7 +109,7 @@ module.exports = Vue.component('app-main', {
|
|||||||
this.command = project.command.slice(0, 3);
|
this.command = project.command.slice(0, 3);
|
||||||
this.moreCommand = project.command.slice(3);
|
this.moreCommand = project.command.slice(3);
|
||||||
|
|
||||||
createXTerm(project.name, this.$els.terminal);
|
openXTerm(project.name);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -129,13 +128,7 @@ module.exports = Vue.component('app-main', {
|
|||||||
this.showSetting = true;
|
this.showSetting = true;
|
||||||
},
|
},
|
||||||
remove: function (){
|
remove: function (){
|
||||||
var runtime = window.AppRuntime[this.project.name];
|
closeXTerm(this.project.name);
|
||||||
|
|
||||||
if (runtime) {
|
|
||||||
runtime.xterm.close();
|
|
||||||
|
|
||||||
delete window.AppRuntime[this.project.name];
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove project
|
// remove project
|
||||||
this.projects.splice(this.activeIndex, 1);
|
this.projects.splice(this.activeIndex, 1);
|
||||||
@ -177,9 +170,10 @@ module.exports = Vue.component('app-main', {
|
|||||||
|
|
||||||
if (runtime) {
|
if (runtime) {
|
||||||
|
|
||||||
runtime.xterm.write(data + '');
|
worker.postMessage({ atcion: 'write', name: project.name, data: data + '' });
|
||||||
|
|
||||||
if (project.name === context.project.name) {
|
if (project.name === context.project.name) {
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.sender.send('emulator', project, 'stop');
|
event.sender.send('emulator', project, 'stop');
|
||||||
@ -187,6 +181,6 @@ module.exports = Vue.component('app-main', {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
ready: function (){
|
ready: function (){
|
||||||
createXTerm(this.project.name, this.$els.terminal);
|
openXTerm(this.project.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
13
static/js/components/app-main/terminal-worker.js
Normal file
13
static/js/components/app-main/terminal-worker.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Created by nuintun on 2015/12/2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
importScripts('../../terminal/index.js');
|
||||||
|
|
||||||
|
var RUNCACHE = {};
|
||||||
|
|
||||||
|
onmessage = function (event){
|
||||||
|
console.log(event.data);
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user