Skip to content

Commit fff4dc1

Browse files
committed
New Async appman
1 parent c624b25 commit fff4dc1

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

js/apps/example/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
/* global $$ */
1+
// Example application for JsOS
2+
// By PROPHESSOR
23

34
'use strict';
5+
let io;
46

5-
const io = $$.stdio.defaultStdio;
6-
7-
function main() {
7+
function main(api, res) {
8+
io = api.stdio;
89
io.setColor('green');
910
io.writeLine('It works!!!');
10-
return 0; // 1 = error
11+
return res(0); // 1 = error
1112
}
1213

13-
exports.call = (cmd, args, api) => main();
14+
exports.call = (cmd, args, api, res) => main(api, res);
1415

1516
exports.commands = ['example'];

js/service/appman/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ class App {
7373
return res('App doesn\'t exist!');
7474
}
7575
const args = _args.join(' ');
76-
const callback = PERSISTENCE.Apps[app].run(app, args, f);
77-
return res(callback);
76+
/* const callback = */PERSISTENCE.Apps[app].run(app, args, f, res);
77+
// return res(callback);
7878
// return console.warn('Not implemented!');
7979
}
8080

js/service/shell/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const assert = require('assert');
2121
const runtime = require('../../core');
2222
const commands = new Map();
2323
const stdio = runtime.stdio.defaultStdio;
24+
const keyboard = require('../../core/keyboard');
2425

2526
exports.setCommand = (name, cb) => {
2627
assert(typeutils.isString(name));
@@ -48,6 +49,7 @@ exports.runCommand = (name, args, done) => {
4849
opts.stdio = opts.stdio || runtime.stdio.defaultStdio;
4950
commands.get(name).run(stringargs, {
5051
stdio: opts.stdio,
52+
keyboard,
5153
}, done);
5254
};
5355

0 commit comments

Comments
 (0)