Implemented fs
module (#19)
This commit is contained in:
parent
36c873b825
commit
55fe1d144f
7 changed files with 535 additions and 13 deletions
12
src/lib.rs
12
src/lib.rs
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue