You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a JS Hook looks like defined below, where Hook and Callback are defined as a non exported Function:
constHook=()=>{///}constCallback=()=>{///}
For the sake of preventing compilers to tree shake the entire function, in reality they have to be exported, but then the export makes QuickJS currently fall over.
Request 1
Pick up the Hook from a module exported function, so make this work:
Then I'd like to throw in the triggering TX object, always, and take the compute for granted (as most JS devs will want to do something with the incoming TX anyway. To prevent them from always having to call the otxn_json anyway, I propose that JS Hooks both Hook and Callback get the triggering TX otxn_json as argument, always, and move the current args to the second arg.
Here's an example Hook as I would like to work (if it works, it will trace the triggering TX JSON):
exportconstHook=(tx,code)=>{trace('triggertxjson',tx)trace('code',code||'none')returnaccept('Sample Hook (End of Hook)',123)}exportconstCallback=(tx,emittedtxerror)=>{trace('triggertxjson',tx)trace('emittedtxerror',emittedtxerror||'none')returnaccept('Sample Hook (End of Callback)',1337)}
The text was updated successfully, but these errors were encountered:
Yeah that works too :) It's not really about the order of the params but more the fact that they have it at their disposal instead of having to separately call to fetch it.
Currently a JS Hook looks like defined below, where Hook and Callback are defined as a non exported Function:
For the sake of preventing compilers to tree shake the entire function, in reality they have to be exported, but then the export makes QuickJS currently fall over.
Request 1
Pick up the Hook from a module exported function, so make this work:
Request 2
Then I'd like to throw in the triggering TX object, always, and take the compute for granted (as most JS devs will want to do something with the incoming TX anyway. To prevent them from always having to call the
otxn_json
anyway, I propose that JS Hooks both Hook and Callback get the triggering TXotxn_json
as argument, always, and move the current args to the second arg.Here's an example Hook as I would like to work (if it works, it will trace the triggering TX JSON):
The text was updated successfully, but these errors were encountered: