#firebase #wasm-bindgen #firebase-database #npm-package #firebase-js

bin+lib firebase-js-sys

wasm32-unknown-unknown bindings for the Firebase modular JS SDK (npm firebase@9)

1 unstable release

0.1.0 Apr 25, 2023

#1276 in WebAssembly


Used in firebase-js

MIT license

2MB
10K SLoC

JavaScript 10K SLoC // 0.3% comments Rust 37 SLoC // 0.2% comments TypeScript 28 SLoC // 0.1% comments

Firebase JS SYS

Raw wrappers around the firebase npm package for Rust consumption. Delicious!

See the firebase-js package for a high level implementation layer ontop of this crate, which is probably what you want rather than having to manually deal with each JsValue.

APIs

APIs are exposed in a similar structure to the firebase npm package, using module names like app and database.

Access them like so:

use firebase_js_sys::app;

Inside each module is a ModuleXXX struct, which contains the raw JS bindings generated by wasm-bindgen

use firebase_js_sys::app::ModuleApp;

ModuleApp::initializeApp(JsValue::UNDEFINED);

Internals: Changing npm package version

To change the version of the firebase npm package, you need to update the package.json file in the firebase-js-sys directory.

Then, run pnpm install, and pnpm run js which watches the files in js/* (or simply rollup -c to build once rather than watching).

Then you can run cargo build to build the Rust library, or better pnpm run serve (or just trunk serve) to run the main.rs binary.

Dependencies

~10MB
~182K SLoC