dart_to_js_transpiler 1.0.0 dart_to_js_transpiler: ^1.0.0 copied to clipboard
Dart to JavaScript Transpiler
Dart to JavaScript Transpiler [Beta] #
Usage #
- Add package to your dependencies
- Using decorators from this library mark classes and methods you're willing to expose as JS interface
- Methods of the class that is not marked as exposed will be ignored
- Only public methods can be exposed to JS
- Using
Entrypoint
decorator mark themain
function - Run
pub run build_runner build
- Add
grinder
andcli_pkg
to your dependencies - Following the example create a
tool
folder in the root of the project, creategrind.dart
file inside. - Create
package
folder in the root of the project, createpackage.json
file following the template example- You can use
djt-codegen
lib to create templated JS files with.d.ts
exports as wel
- You can use
- Run
pub run grinder copy-schema
to create a JS buildcd ./build/npm
and runyarn && yarn codegen
in order yo create interfaces
- Your Dart library is now available as the NPM package.