Closed hsandt closed 1 year ago
You're trying to use a +=
operator on a function. It effectively transforms that function into a string. Then when onError
is called, it errors (a string can't be called)
Try
story.onError = (msg, type) => {
instead of +=
Describe the bug
This is a repost of https://github.com/inkle/ink/issues/873 for the inkjs repo. It's not as much a bug as a missing API.
The doc says how to bind onError in C#:
https://github.com/inkle/ink/blob/master/Documentation/RunningYourInk.md
but not in Javascript. I tried to modify main.js to display the error directly on the page:
but I got:
Maybe there is no binding in JS, only C#? But then why the console log error message in browser?
To Reproduce
Try to insert
story.onError += (msg, type) => {}
after story definition.Expected behavior
I expect an equivalent to onError to exist in JS bindings.
Ink files
This happens in JS not the ink script itself, so copy the JS suggested above into main.js instead.
Environment