diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-01 03:59:25 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-01 03:59:25 +0200 |
| commit | dbbeffd02629209f42affe3fb4bb4c46639ba0e3 (patch) | |
| tree | fbd15c10cd5303eaaccbf0162401424209b684e6 /app/client/socket | |
| parent | 964ac7009e6db5a06233bdc07fa63778eebf2db7 (diff) | |
remote IPC... done so sweetly, with promises and async
Diffstat (limited to 'app/client/socket')
| -rw-r--r-- | app/client/socket/socket.actions.js | 6 | ||||
| -rw-r--r-- | app/client/socket/socket.system.js | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/app/client/socket/socket.actions.js b/app/client/socket/socket.actions.js index 574892a..a2162ac 100644 --- a/app/client/socket/socket.actions.js +++ b/app/client/socket/socket.actions.js @@ -1,3 +1,7 @@ -import { list_directory_async } from './socket.system' +import { + list_directory_async, + run_system_command_async +} from './socket.system' export const list_directory = list_directory_async +export const run_system_command = run_system_command_async
\ No newline at end of file diff --git a/app/client/socket/socket.system.js b/app/client/socket/socket.system.js index 11cb44c..ad9e8ac 100644 --- a/app/client/socket/socket.system.js +++ b/app/client/socket/socket.system.js @@ -59,7 +59,10 @@ export function list_directory(opt) { } export function list_directory_async(opt) { - return syscall_async('list_directory', opt) + return syscall_async('list_directory', opt).then(res => res.files) +} +export function run_system_command_async(opt) { + return syscall_async('run_system_command', opt) } export const syscall_async = (tag, payload, ttl=10000) => { @@ -70,6 +73,7 @@ export const syscall_async = (tag, payload, ttl=10000) => { reject('timeout') }, ttl) const cb = (data) => { + if (!data.uuid) return if (data.uuid === uuid) { clearTimeout(timeout) socket.off('system_res', cb) |
