Git Product home page Git Product logo

atom's People

Contributors

dependabot[bot] avatar staydecent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

atom's Issues

Mention Flux Standard Action in README

https://github.com/acdlite/flux-standard-action

Potentially include a helper function (without Ramda dependancy):

import merge from 'ramda/src/merge'
import pick from 'ramda/src/pick'
import curryN from 'ramda/src/curryN'

export const createAction = curryN(2, (type, payload, extra) => {
  let action = {type, payload}
  if (extra) {
    return merge(action, pick(['meta', 'error'], extra))
  }
  return action
})

export default createAction

If more functionality is desired then recommend https://github.com/acdlite/redux-actions

ability to swap `reducer(action, state)` to `reducer(state, action)`

this would need to be part of a config type object that is passed to the atom store creator function. enabling this would allow for closer compatibility with redux.

another crazy idea is let the arg order be defined on the reducer's prototype so arg order could be mixed in a single store...

but then maybe any redux based reducer could just be wrapped in a function that flips the args (Ramda.flip)?

experiment with middleware

  • Can it be an external lib so atom default bundle can remain tiny?
var store = atom(applyMiddleware([someMiddleware], counter), 0)

Could the applyMiddleware just wrap each middleware in a function that returns unchanged state?
Do the middleware functions need a way to halt progress, a la next()?

pathSet and pathGet in store

Not sure where to post this request, maybe pwa-starter or elements would be better.

In some side projects I've been using a store with get and set functions that I find very useful. With wasmuth naming it would be path and pathSet I think. Anyways it looks like this.

store.get([]) returns entire state
store.get(['nested', 'value']) get nested value
store.set(['nested', 'value'], newValue) sets nested value

I also added a store.setBatch which is used like

store.setBatch(
    [['nested', 'value'], newValue],
    [['nested', 'somewhereElse'], another value],
)

Add batch api to group an array of dispatches

instead of:

dispatch(anEvent)
dispatch(anotherEvent)

Could batch them:

batch(anEvent, anotherEvent)

And subscribers would only be called after all actions in given to batch have run

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.