docx-rs/docx-wasm/src/web_extension.rs

30 lines
622 B
Rust
Raw Normal View History

use wasm_bindgen::prelude::*;
#[wasm_bindgen]
#[derive(Debug)]
pub struct WebExtension(docx_rs::WebExtension);
#[wasm_bindgen(js_name = createWebExtension)]
pub fn create_web_extension(
id: &str,
version: &str,
store: &str,
store_type: &str,
) -> WebExtension {
WebExtension(docx_rs::WebExtension::new(id, version, store, store_type))
}
impl WebExtension {
pub fn take(self) -> docx_rs::WebExtension {
self.0
}
}
#[wasm_bindgen]
impl WebExtension {
pub fn property(mut self, name: &str, value: &str) -> Self {
self.0 = self.0.property(name, value);
self
}
}