Closed ericprud closed 4 years ago
That's mixing async/await and callbacks. If that worked at all it's due to some older callback compatibility code that will eventually be removed. You should be able to do what's in the docs and just use async/await and promises style code. Do you have a short runnable example that fails? Also is this with the latest jsonld.js code?
A minor performance tweak, depending on your use case, might be to store the parsed JSON in Overrides so you don't have to re-parse it every load.
My mistake, I wasn't using a new jsonld. It all works as expected with the latest major version.
https://www.npmjs.com/package/jsonld#custom-document-loader suggests that a documentLoader can return a structure with a
document
property. When trying this withtoRDF
, I needed to call a callback with that structure of the event loop would drain without ever coming back from the asyn call. This is roughly what worked for me:Should that be in the docs?