forked from cory/tildefriends
Use proper js modules for apps. Kludge enough things to make things seem to work. Need to apply this to core still.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3862 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
14
core/app.js
14
core/app.js
@ -1,5 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var auth = require('auth');
|
||||
var core = require('core');
|
||||
|
||||
var gSessionIndex = 0;
|
||||
|
||||
function makeSessionId() {
|
||||
return (gSessionIndex++).toString();
|
||||
}
|
||||
|
||||
function App() {
|
||||
this._on_output = null;
|
||||
this._send_queue = [];
|
||||
@ -96,7 +105,7 @@ function socket(request, response, client) {
|
||||
options.packageName = packageName;
|
||||
var sessionId = makeSessionId();
|
||||
if (blobId) {
|
||||
process = await getSessionProcessBlob(blobId, sessionId, options);
|
||||
process = await core.getSessionProcessBlob(blobId, sessionId, options);
|
||||
}
|
||||
if (process) {
|
||||
process.app.readOutput(function(message) {
|
||||
@ -140,7 +149,7 @@ function socket(request, response, client) {
|
||||
}
|
||||
} else {
|
||||
if (process && process.eventHandlers['message']) {
|
||||
await invoke(process.eventHandlers['message'], [message]);
|
||||
await core.invoke(process.eventHandlers['message'], [message]);
|
||||
}
|
||||
}
|
||||
} else if (event.opCode == 0x8) {
|
||||
@ -160,3 +169,4 @@ function socket(request, response, client) {
|
||||
}
|
||||
|
||||
exports.socket = socket;
|
||||
exports.App = App;
|
||||
|
Reference in New Issue
Block a user