Get value from Python package in JavaScript app

The GetValue method is used to retrieve the result of an operation performed by the Javonet API.

// use activate only once in your app
Javonet.activate('your-license-key')

// create called runtime context
let calledRuntime = Javonet.inMemory().python()

// construct an invocation context - this invocationContext in non-materialized
let invocationContext = calledRuntime.getType('builtins').invokeStaticMethod('abs', -50)

// execute invocation context - this will materialize the invocationContext
let response = invocationContext.execute()

// get value from response
let result = response.getValue()

// write result to console
console.log(result)

Commands are becoming nested through each invocation of methods on Invocation Context. Each invocation triggers the creation of new Invocation Context instance wrapping the current command with new parent command valid for invoked method.

Developer can decided on any moment of the materialization for the context taking full control of the chunks of the expression being transferred and processed on target runtime.