Move date functions to a seperate file

This commit is contained in:
Yash Karandikar 2021-10-23 20:29:52 -05:00
parent 2bd64cfb8a
commit 0f8cc4d020
Signed by: karx
GPG key ID: A794DA2529474BA5
3 changed files with 13 additions and 9 deletions

View file

@ -1,5 +1,6 @@
use sycamore::prelude::*;
use wasm_bindgen::prelude::*;
use crate::date::get_current_time_millis;
use crate::{local_storage, AppMode};
@ -15,14 +16,6 @@ impl DefaultViewProps {
}
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_name = getCurrentTimeMillis)]
fn get_current_time_millis() -> usize;
#[wasm_bindgen(js_name = timeHR)]
fn time_hr(millis: usize) -> String;
}
#[component(DefaultView<G>)]
pub fn default_view(props: DefaultViewProps) -> Template<G> {

10
noters/src/date.rs Normal file
View file

@ -0,0 +1,10 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_name = getCurrentTimeMillis)]
pub fn get_current_time_millis() -> usize;
#[wasm_bindgen(js_name = timeHR)]
pub fn time_hr(millis: usize) -> String;
}

View file

@ -2,6 +2,7 @@
mod components;
mod console;
mod date;
mod local_storage;
use sycamore::prelude::*;