Coder Social home page Coder Social logo

Lifecycle hooks about spect HOT 2 CLOSED

dy avatar dy commented on September 1, 2024
Lifecycle hooks

from spect.

Comments (2)

dy avatar dy commented on September 1, 2024

! quite elegant mount-fx solution is mount(() => () => /* unmount */)

from spect.

dy avatar dy commented on September 1, 2024

? should selector aspects call destructor on unmount?

  • sounds meaningful to free memory
    − we [can] keep aspects as weak refs
    • still destructor is meaningful to clean up aspect
      . there's no destructor. There's main render and mount/unmount hooks.
      ? should non-selector aspects keep element reference regardless of mount/unmount?
      . possibly such "independent" elements should be handled in reference to context aspects, so if they disappear from the parent aspect's scope, their own aspect's destructor is called. But if they were initialized at the root, eg. $(document.body), then destructor is impossible to be reached.
      . for some real elements aspects can create blocking refs. For example, user wants to remove this element - but if there was an aspect registered at the root level as $(el, aspect), this aspect will remain after the mount/unmount. Best we can - keep aspects as weak as possible and encourage removing refs on unmount.
      . without mount/unmount hooks we'd re-register state every re-render, so they should be scoped.

from spect.

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.