// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.

///|
#external
pub type GLTFExporter

///|
#module("@mizchi/three-mbt/exporters")
pub extern "js" fn GLTFExporter::GLTFExporter() -> GLTFExporter = "gLTFExporter"

///|
pub extern "js" fn GLTFExporter::register(
  self : GLTFExporter,
  factory : (GLTFWriter) -> GLTFExporterPlugin,
) -> GLTFExporterRegistration =
  #| (self, factory) => { const callback=context=>factory(context);self.register(callback);return {owner:self,callback,active:true}; }

///|
extern "js" fn GLTFExporter::ffi_unregister(
  self : GLTFExporter,
  registration : GLTFExporterRegistration,
) -> JsResult[Unit] =
  #| (self, registration) => { try { return { ok: true, value: (() => { if(registration.owner!==self)throw new TypeError("Registration belongs to a different owner");if(registration.active){self.unregister(registration.callback);registration.active=false;} })() }; } catch (error) { return { ok: false, error: String(error) }; } }

///|
pub fn GLTFExporter::unregister(
  self : GLTFExporter,
  registration : GLTFExporterRegistration,
) -> Unit raise ExportError {
  match self.ffi_unregister(registration).into_result() {
    Ok(value) => value
    Err(message) => raise ExportError(message)
  }
}