sketchup-bridge icon indicating copy to clipboard operation
sketchup-bridge copied to clipboard

Offer as an ES6 import?

Open Macavirus opened this issue 6 years ago • 1 comments

It might be good to package this as a separate ES6 module to import. I'm not totally sure how to go from the IIFE that bridge.js currently is to a module export.

To be clear, this would help my use case, though I expect that the current form is most useful to a general audience who will drop this in a script tag instead.

Macavirus avatar Feb 06 '19 09:02 Macavirus

It's a tradeoff between ease of use for beginners and comfort for experienced developers.

You have probably seen, the original code was hand-written (ES4 or ES5 I think) for widest compatibility and without need for compiler/transpiler tools. For easier distribution I have here merged multiple files into one.

  • I could switch to writing everything in modern JavaScript (with imports/exports) and compiling for older browser engines.
  • Or there is a way to make it importable as ES6 module (maybe with a wrapper?). Maybe this is helpful: https://stackoverflow.com/questions/32805234/import-existing-amd-module-into-es6-module

Aerilius avatar Feb 06 '19 10:02 Aerilius