Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
fiatjaf
@fiatjaf
what is Cycle Diverse?
André Staltz
@staltz
The next big version of Cycle supporting RxJS v5, most.js and xstream
David Schalk
@dschalk
A persistent, shared todo list; a websockets game; chat rooms and more running flawlessly (as far as I can tell ) in a Motorcycle.js application. The repo is at JS-monads-part6 and the online demonstration is at http://schalk.net:3055. There are two major cycles involved in the application. Motorcycle.js is one. The other is processed user input going to the modified Haskell Wai Websockets server and then being received (sometimes after server processing) by group members for parsing and updating the virtual DOM . My JS-monads are in a mature state now, and are very helpful in running the application in an understandable, easily maintainable, reactive manner. I feel so relaxed and and unburdened now that React.js and Node.js are becoming distant memories.
Marcus Nielsen
@marcusnielsen
@mariuslundgard how do you think a req/res feedback cycle should work? I think websockets are a better natural fit than http req/res.
Dmitrii 'Mamut' Dimandt
@dmitriid
@SteveALee Awesome presentation. Brain aches, wants and possible bugs hit close to home :)
Steve Lee
@SteveALee
@dmitriid thanks. Good to know it's not just me! :)
byt the way another big win of XStream is .do(x=>console.log(x)) -> .debug(x) ftw
André Staltz
@staltz
It's actually .debug() :) even easier
Alex
@whitecolor
btw I use my https://github.com/whitecolor/rx-log for the same purpose xxx$.log('xxx').map(...
Marius Lundgård
@mariuslundgard
@marcusnielsen I have a work-in-progress req/res driver https://github.com/mariuslundgard/cycle-http-context-driver/blob/develop/src/http-context-driver.ts. It's similar to how RPC works using a message queue (in that it passes the response around for correlation).
And used like this in a component:
import {HTTPContext} from '../../http-context-driver'

function FrontPage ({HTTP}) {
  return {
    HTTP: HTTP.map((ctx: HTTPContext) => {
      const outgoing: HTTPContext = {
        request: ctx.request,
        response: ctx.response,
        body: 'FrontPage'
      }

      return outgoing
    })
  }
}

export default FrontPage
I'm not sure it's a perfect fit for req/res, however I find it nice to be able to deal with req/res in a similar manner as the rest of the app.
Marcus Nielsen
@marcusnielsen

@mariuslundgard awesome! You got a github star :-)
I hope I can start wrapping https://github.com/marcusnielsen/rxjs-server as a cycle.js driver in the future. And I would love to have the req/res-part available as well.

I just don’t have the time to figure out if I need cycle.js or not in my projects. But I do use most of the thoughts I’ve heard about MVI, but as model, view, interactions, and state.

where interactions are actions (input functions), events (output event streams), and reactions (chaining composed events).
Raquel Moss
@raquelxmoss

Does anyone have any ideas on how to listen for keypress events on the entire app, without adding an input for the user to type into?

The following works for mouse clicks, but not keypresses.

input$ = DOM.select(':root')
  .events('keypress')
Daniel Hodan
@czertbytes
select on document
i mean try, input$ = DOM.select(document).events('keypress')
Raquel Moss
@raquelxmoss
Looks like that's not allowed: render-dom.js:206 Uncaught Error: DOM driver's select() expects the argument to be a string as a CSS selector
Which makes sense to me...selecting document feels a bit weird.
Daniel Hodan
@czertbytes
sorry for confusion ;) my fault, i used https://github.com/TylorS/cycle-snabbdom/blob/master/src/fromEvent.js#L37 and it worked for me ;(
Raquel Moss
@raquelxmoss
Ah right, thanks! I might try that at some point, for now I'll just add an input
Daniel Hodan
@czertbytes
okay, my last "help" const input$ = Rx.Observable.fromEvent(document, 'keypress'); works for me
Tylor Steinberger
@TylorS
Hey @czertbytes You usually don't want to do that type of thing inside of main(). You'd generally want to make that driver.
Cycle.run(main, {
  keypress$: () => Rx.Observable.fromEvent(document, 'keypress')
})
The reason DOM.select() doesn't select from document, is because it's external to your main(). Drivers are the place where you listen to what is external to your main().
Daniel Hodan
@czertbytes
hi @TylorS , right, thanks ;)
Tylor Steinberger
@TylorS
:+1: No problem.
Raquel Moss
@raquelxmoss
Oh good, my instincts were right :-) thanks @TylorS
Steve Lee
@SteveALee
@TylorS you were missed at cycleconf :(
The #cycleconf live stream https://youtu.be/B2BFwIshais
Steve Lee
@SteveALee
@raquelxmoss @Tylor, agree, am using handler on doc in driver
Other attempts were intermittently successful, presumably dependent on where focus was
Dmitrii 'Mamut' Dimandt
@dmitriid
  • CycleConf: awesome
  • Participants: awesome
  • 10/10: would do it again
I will write a blog post or two about my experiences with cycle.js as a n00b :)
Also, finally starting a proper project in cycle today
w00t
Dmitrii 'Mamut' Dimandt
@dmitriid
It also amused me to no end that there were TWO Moldovans at the conference. And one of them was giving a talk :)
Dmitrii 'Mamut' Dimandt
@dmitriid
also, a question: I'd like to use Cycle Diversity and XStream right away:
  • is it wise?
  • where do I get them?
Vincent Orr
@Cmdv
well they are both still in development so I wouldn’t advise it just yet, xstream is on staltz github account and diversity is on a branch on core :)
Raphael Mu
@edge
I'd wait at least until #196 is closed
André Staltz
@staltz
@dmitriid great summary :D
Dmitrii 'Mamut' Dimandt
@dmitriid
@Cmdv @edge Thanks!
André Staltz
@staltz
xstream can be used as npm install xstream and reading the README
Dmitrii 'Mamut' Dimandt
@dmitriid
@staltz I have to use all this while I'm still inspired, or I'll end up like the dog in @SteveALee's presentation :)
André Staltz
@staltz
Cycle Diversity works, it's not incomplete, but it's release candidate because we don't have docs yet
Dmitrii 'Mamut' Dimandt
@dmitriid
cool
André Staltz
@staltz
but the migration is rather simple. most of the code stays unchanged
Dmitrii 'Mamut' Dimandt
@dmitriid
I like the sound of that :)
André Staltz
@staltz
I'd recommend people at least try to convert their codebases to Diversity
I already did with power-ui and it worked...
Raphael Mu
@edge
haven't been keeping up with Diversity but I assume if I use xstream-run and some other driver uses rx, both xstream and rx would be in the final bundle?