Giter Club home page Giter Club logo

ople's People

Contributors

aleclarson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ople's Issues

Concurrent mode

Currently, the useOple hook does not support Concurrent mode. (The useEvents hook does though)

Ople objects should be able to detach all their effects, but then reattach them at a later point. This will allow useOple to wait until the "commit phase" (eg: when useEffect is called) before receiving events and enabling reactions.

Fire function on dispose

It would be great to be able to fire an event or function when an Ople object is disposed. Is this possible?

Throw on mutation outside Ople context

Not sure if this is that useful, since OpleObjects are deep readonly (in TypeScript world) outside their constructor already.

But I'll keep this issue open to gauge interest. It would be useful for JavaScript users, I suppose.

Auto-emit events

I'm not sure if should sit in the realm of the user, and possibly has performance implications, but for my use case, I would typically like to fire an event each time an Ople object's property / attribute changes (and create / dispose events). Without it a find myself subscribing to changes using wana and it might be nicer to have it built into Ople - should be easy to automate regardless so no biggie.

Prevent `emit` calls outside the associated Ople context

Events are not supposed to be emitted outside the constructor scope.

If you need external side effects, expose a method on your OpleObject with the set function.

This prevents a whole class of errors where you accidentally emit an event when you're supposed to call a method instead.

Recommended approach to updating react components

I'm rebuilding the standard redux todo-mvc in Ople here https://codesandbox.io/s/todomvc-8fb7u

And I'm at a point where I need to update react components on change.
What's the recommended approach for this?

Is it by emitting and listening to events with useEvents?
Or is there some sort useAuto like function, similar to wana? (It doesn't seem like I can use wana's withAuto)

Are Ople objects observable? Maybe I'm just assuming that because I know it's built on wana.

What does set() do?

What does set() do? (Apologies for all the questions, please take your time to respond)

ie. Why should I be doing this?

  constructor(props) {
    super()
    initOple(this, (self, set, emit) => {
      set(props)
    })
  }
const Todo = createClass(
  'Todo',
  props => (todo, set, emit) => {
    set(props)
  }
)

instead of this?

  constructor(props) {
    super()
    Object.keys(props).forEach(p => this[p] = props[p])
    initOple(this, (self, set, emit) => {
      // ...
    })
  }
const Todo = createClass(
  'Todo',
  props => (todo, set, emit) => {
    ...props
  }
)

Disable observation within methods of Ople subclass

Only methods defined with the set function are wrapped with no (which disables observation) and withOple (which sets the Ople context). In a future version, when an Ople subclass is first constructed, the Ople constructor will search the prototype chain for methods to wrap.

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.