The Go SDK was designed with this sort of thing in...
# contribute
b
The Go SDK was designed with this sort of thing in mind, and gives you access to more internals. Might be difficult with the JavaScript SDK, though, because the language host shields you from a lot of the setup/teardown. Because of that, it generally assumes "one program invocation" == "one update."