Giter VIP home page Giter VIP logo

Comments (3)

chinedufn avatar chinedufn commented on May 28, 2024

Heads up I plan to address this issue over the weekend! Hang tight, sorry!

from percy.

chinedufn avatar chinedufn commented on May 28, 2024

What is Subscription? Can you show me the definition for that?


In terms of requestAnimationFrame, I can update the example to show how to do it.

I'd like to rewrite the example using some of the things that I've learned in the last couple of years, so this can be part of that work stream.

from percy.

aldebaranzbradaradjan avatar aldebaranzbradaradjan commented on May 28, 2024

Hi, nice to see a response :)

So, Subscription is part of redux_rs crate, i think it works like your store in the example here : https://github.com/chinedufn/percy/blob/master/examples/isomorphic/app/src/store.rs and https://github.com/chinedufn/percy/blob/master/examples/isomorphic/client/src/lib.rs

In your example you do this :

    // TODO: Use request animation frame from web_sys
    // https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Window.html#method.request_animation_frame
        app.store.borrow_mut().subscribe(Box::new(|| {
            web_sys::console::log_1(&"Updating state".into());
            global_js.update();
        }));

The definition of Subscription : https://docs.rs/redux-rs/0.1.0/redux_rs/type.Subscription.html
The definition force the use of a function ( fn(_: &State); ) but if i use a closure that catch scope variables it can't be converted as function, it's remain as a closure. So I can maybe call my render update with the subscription of redux_rs if I modify the crate, but I don't know how to do this. This is why I'm interested by your solution with request_animation_frame :)

I will wait for your example rewrite in this case ! Thanks !

from percy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.