Implemented fs module (#19)

This commit is contained in:
bicarlsen 2023-09-10 09:24:27 +02:00 committed by GitHub
parent 36c873b825
commit 55fe1d144f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 535 additions and 13 deletions

View file

@ -127,6 +127,8 @@ pub mod dialog;
mod error;
#[cfg(feature = "event")]
pub mod event;
#[cfg(feature = "fs")]
pub mod fs;
#[cfg(feature = "global_shortcut")]
pub mod global_shortcut;
#[cfg(feature = "mocks")]
@ -155,24 +157,24 @@ pub(crate) mod utils {
pos: u32,
arr: js_sys::Array,
}
impl ArrayIterator {
pub fn new(arr: js_sys::Array) -> Self {
Self { pos: 0, arr }
}
}
impl Iterator for ArrayIterator {
type Item = wasm_bindgen::JsValue;
fn next(&mut self) -> Option<Self::Item> {
let raw = self.arr.get(self.pos);
if raw.is_undefined() {
None
} else {
self.pos += 1;
Some(raw)
}
}