ehn-dcc-development / hcert-kotlin

Kotlin multiplatform implementation of the HCERT/DCC specification
Apache License 2.0
25 stars 25 forks source link

Remove Inline Javascript #45

Closed JesusMcCloud closed 3 years ago

JesusMcCloud commented 3 years ago

On some occasions we are still using inline JS code. It would be really nice to get rid of

This requires some more effort, since there are certain situations where the generated externals effectively force us to do so, since the externals themselves are faulty, for example. In addition, some JS functions take JS objects for parameters, therefore we need to make absolutely sure that our type-safe code actually compiles to this very specific object structure. This is especially tricky for higher-order functions edge cases like using numbers for keys…

JesusMcCloud commented 3 years ago

The current state of Kotlin/JS seems to prevent this in certain cases (looking at you, cbor decoder options!). What we can and should do, however, is to encapsulate such workarounds into externals, such that src/jsMain is free of js() and .asDynamic() calls