-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Cleanup host services params handling * Make the use of headers and non-enveloped message payloads consistent across host services * Make header names more self-documenting * Move agent message header constants into agent api package * Use Uint8Array in v8 * Use Bytes() when converting v8 bigint value * Support objects, arrays, an strings when marshaling []byte from v8 value * Use toUInt8ArrayValue() when passing payload into triggered v8 functions * Only deal in native Uint8Array in v8 functions * Make native v8 utility function name consistent * Remove unused code * Cleanup basic echofunction.js test
- Loading branch information
Showing
13 changed files
with
245 additions
and
488 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,38 @@ | ||
(subject, payload) => { | ||
this.hostServices.messaging.publish('hello.world', payload); | ||
|
||
var req; | ||
var reqResp; | ||
var reqEx; | ||
|
||
var reqMany; | ||
var reqManyResp; | ||
var reqManyEx; | ||
|
||
try { | ||
req = this.hostServices.messaging.request('hello.world.request', payload); | ||
reqResp = this.hostServices.messaging.request('hello.world.request', payload); | ||
reqResp = String.fromCharCode(...reqResp) | ||
} catch (e) { | ||
reqEx = e; | ||
} | ||
|
||
try { | ||
reqMany = this.hostServices.messaging.requestMany('hello.world.request.many', payload); | ||
reqManyResp = [] | ||
|
||
let responses = this.hostServices.messaging.requestMany('hello.world.request.many', payload) | ||
|
||
// responses is an array of Uint8Array... flatten it so we can use each value | ||
responses = Array.prototype.slice.call(responses) | ||
|
||
for (let i = 0; i < responses.length; i++) { | ||
reqManyResp.push(String.fromCharCode(...responses[i])) | ||
} | ||
} catch (e) { | ||
reqManyEx = e; | ||
} | ||
|
||
return { | ||
'hello.world.request': req, | ||
'hello.world.request': reqResp, | ||
'hello.world.request.ex': reqEx, | ||
'hello.world.request.many': reqMany, | ||
'hello.world.request.many': reqManyResp, | ||
'hello.world.request.many.ex': reqManyEx | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.