Skip to content

Instantly share code, notes, and snippets.

View ealmloff's full-sized avatar

Evan Almloff ealmloff

View GitHub Profile
@ealmloff
ealmloff / test.md
Last active December 28, 2023 00:09
Screenshot 2023-12-27 at 6 08 51 PM
#![allow(non_snake_case)]
use dioxus_signals::use_signal;
use dioxus::prelude::*;
use dioxus_fullstack::prelude::*;
fn main() {
LaunchBuilder::new(App).launch();
}
fn App(cx: Scope) -> Element {
window.addEventListener('scroll', () => {
let scrollTop = window.scrollY;
let winHeight = window.document.documentElement.scrollHeight - window.document.documentElement.clientHeight;
let new_scroll = Math.min(Math.max(scrollTop, 0) / Math.max(winHeight, 1), 1);
document.body.style.setProperty('--scroll', new_scroll);
}, false);
#![allow(non_snake_case)]
use dioxus::prelude::*;
use std::cell::{Ref, RefCell, RefMut};
use std::collections::HashSet;
use std::fmt::Display;
use std::rc::Rc;
#[derive(Clone)]
struct SplitSubscriptions {
a: LocalSubscription<i32>,