-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Holo-Host/B-03763-signals
B-03763 - handle signals
- Loading branch information
Showing
4 changed files
with
104 additions
and
53 deletions.
There are no files selected for viewing
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,35 +1,37 @@ | ||
|
||
<script src="/comb/holo_hosting_comb.js"></script> | ||
|
||
<h1>Chaperone!</h1> | ||
|
||
<script type="text/javascript"> | ||
(async function () { | ||
(async function () { | ||
|
||
function HolochainTestError(message) { | ||
this.name = "HolochainTestError"; | ||
this.message = (message || ""); | ||
} | ||
HolochainTestError.prototype = Error.prototype; | ||
function HolochainTestError(message) { | ||
this.name = "HolochainTestError"; | ||
this.message = (message || ""); | ||
} | ||
HolochainTestError.prototype = Error.prototype; | ||
|
||
try { | ||
COMB.debug(); | ||
const parent = await COMB.listen({ | ||
"test": async function ( ...args ) { | ||
return "Hello World: " + JSON.stringify(args); | ||
}, | ||
"test_synchronous": function () { | ||
return "Hello World"; | ||
}, | ||
"test_error": function ( ...args ) { | ||
return new HolochainTestError("Method did not succeed\n" + JSON.stringify(args)); | ||
}, | ||
"test_synchronous_error": function () { | ||
return new HolochainTestError("Method did not succeed"); | ||
} | ||
}); | ||
} catch ( err ) { | ||
console.error( String(err) ); | ||
} | ||
})(); | ||
try { | ||
COMB.debug(); | ||
const parent = await COMB.listen({ | ||
"test": async function (...args) { | ||
return "Hello World: " + JSON.stringify(args); | ||
}, | ||
"test_synchronous": function () { | ||
return "Hello World"; | ||
}, | ||
"test_signal": function (signal) { | ||
return parent.sendSignal(signal) | ||
}, | ||
"test_error": function (...args) { | ||
return new HolochainTestError("Method did not succeed\n" + JSON.stringify(args)); | ||
}, | ||
"test_synchronous_error": function () { | ||
return new HolochainTestError("Method did not succeed"); | ||
} | ||
}); | ||
} catch (err) { | ||
console.error(String(err)); | ||
} | ||
})(); | ||
</script> |
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