libkernel
Advanced tools
Comparing version 0.0.46 to 0.0.47
@@ -202,3 +202,3 @@ // log provides a wrapper for console.log that prefixes 'libkernel'. | ||
bridgeExists = false; | ||
bridgeAvailable.reject(new Error("bridge unavailable, need skynet extension")); | ||
bridgeAvailable.reject("bridge unavailable, need skynet extension"); | ||
logErr("bridge did not respond after 2 seconds"); | ||
@@ -205,0 +205,0 @@ } |
export declare function testMessage(): Promise<string>; | ||
export declare function callModule(module: string, moduleMethod: string, moduleInput: any): Promise<any>; | ||
export declare function callModule(module: string, method: string, data: any): Promise<any>; | ||
export declare function upload(filename: string, fileData: Uint8Array): Promise<string>; | ||
export declare function padAndEncrypt(filepath: string, fileData: Uint8Array): Promise<string>; |
@@ -67,3 +67,7 @@ import { logErr, composeErr, init, newKernelQuery } from './init'; | ||
// handled for the user. | ||
export function callModule(module, moduleMethod, moduleInput) { | ||
// | ||
// callModule can only be used for query-response communications, there is no | ||
// support for sending queryUpdate messages or receiving responseUpdate | ||
// messages. If you need those, use 'connectModule' instead. | ||
export function callModule(module, method, data) { | ||
return new Promise((resolve, reject) => { | ||
@@ -74,5 +78,7 @@ init() | ||
method: "moduleCall", | ||
module, | ||
moduleMethod, | ||
moduleInput, | ||
data: { | ||
module, | ||
method, | ||
data, | ||
} | ||
}, null); | ||
@@ -83,4 +89,3 @@ query.then(response => { | ||
.catch(err => { | ||
// Consumer doesn't care about the reponse or | ||
// the query status. | ||
let cErr = composeErr("moduleCall query to kernel failed", err); | ||
reject(err); | ||
@@ -90,3 +95,5 @@ }); | ||
.catch(err => { | ||
reject(err); | ||
let cErr = composeErr(noBridge, err); | ||
logErr(cErr); | ||
reject(cErr); | ||
}); | ||
@@ -93,0 +100,0 @@ }); |
{ | ||
"name": "libkernel", | ||
"version": "0.0.46", | ||
"version": "0.0.47", | ||
"description": "helper library to interact with the skynet kernel", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
15270
383