Hey, does anybody have a robust heuristic they use when wrapping a javascript library? I've wrapped several quite easily, but there are edge cases with others that I don't really understand.
For example,
https://pouchdb.com/?ref=w3use (npm: pouchdb-browser) looks quite straightforward from the docs, but it doesn't seem to let me apply @JsModule to a package (with a PouchDB object or class), object, class, function, or function property (I get the usual "not a constructor", "not a function", etc). (Right now for this one I made a
dynamic
using require (
val DB = require("pouchdb-browser").default; val db = DB("my_new_db")
) and am just delegating to that in a wrapper class, which is fine.) Just an example, but maybe useful to help illustrate the process one can step through to make the JsModule approach work.