Coder Social home page Coder Social logo

Necessity of $ / manual context control about spect HOT 2 CLOSED

dy avatar dy commented on September 1, 2024
Necessity of $ / manual context control

from spect.

Comments (2)

dy avatar dy commented on September 1, 2024

Possible problem of manual context control is:

  • no destructor - not clear how to detach effect
  • async fx figures out current aspect via callstack

yes, that's the problem. Since calling spect is not limited to current scope, we have to push and pop context, that is manual control over context, that can possibly come along with scope-bound control.

  • very similar to incremental-dom. That's actually a high-level extension of it.

So what would that be?

// attach aspect per fn-scope
spect(target, el => {
})

// manual control over scope
groupStart(target)
groupEnd()

What about setting state on manual context? How should that trigger redraw?
Maybe we should provide scope(el), scopeEnd() methods, but only as low-level machinery. state should be able to call defined scope at any moment. For that purpose tiny scoping functionscope(el, () => {}) is the most natural choice.

Whatever good the idea is, that's just a round-walk path: scopeStart is nice, but we have to rerender scope. Defining scope from inside is impossible, must be scope(target, () => {}), which is essentially the same as spect(target, () => {}).

To make spect compatible with jquery, we can make it a default export, so that user would just import $, {} from 'spect', so that if want to rename $ to something different - just import spect from 'spect'

from spect.

dy avatar dy commented on September 1, 2024

Ok, so the initial issues are addressed:

  • to resolve jquery conflict - import $, { fx } from 'spect' to resolve conflict
  • to resolve naming inconsistency - see prev.
  • selector usefulness - it is shortcut.

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.