Coder Social home page Coder Social logo

todomvc-cycle's Introduction

Cycle.js

logo
A functional and reactive JavaScript framework for predictable code

Welcome

Question Answer
"I want to learn Cycle.js" Read the official documentation
"I have a question" Create a StackOverflow question
Or
Join the chat
Or
Open an issue
Please note all discussion-like issues are labeled discussion and immediately closed. This doesn't mean we unconsidered your discussion. We only leave actual issues open.
"I found a bug" Open an issue
"I want to help build Cycle.js" Read the Contributing guides
Then
Choose an issue marked "help wanted"

Packages

Cycle.js is comprised of many specialized packages. This repository contains all these packages, e.g., the npm package @cycle/run lives in the directory run. Below you will find a summary of each package.

Package Version Dependencies DevDependencies
@cycle/dom npm (scoped) Dependency Status devDependency Status
@cycle/history npm (scoped) Dependency Status devDependency Status
@cycle/html npm (scoped) Dependency Status devDependency Status
@cycle/http npm (scoped) Dependency Status devDependency Status
@cycle/isolate npm (scoped) Dependency Status devDependency Status
@cycle/most-run npm (scoped) Dependency Status devDependency Status
@cycle/run npm (scoped) Dependency Status devDependency Status
@cycle/rxjs-run npm (scoped) Dependency Status devDependency Status

Globally: Build Status devDependency Status

Stream libraries

The following packages are not under Cycle.js, but are important dependencies, so we display their latest versions for convenience.

Package Version
most npm version
rxjs npm version
xstream npm version

Support OpenCollective OpenCollective

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Thanks

Browserstack

Browserstack for providing access to their great cross-browser testing tools.

LICENSE

The MIT License


JS.ORG ComVer

todomvc-cycle's People

Contributors

carloslfu avatar cluelessjoe avatar frikki avatar janat08 avatar jaredly avatar kahlil avatar mjethani avatar staltz avatar vkammerer avatar zigomir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

todomvc-cycle's Issues

TaskList does not receive Task actions

You cannot delete, edit or toggle active-state of a Task. Even though actions produced by the intent of Task are triggered, TaskList does not receive those item actions.

confirming the edition of a task yields an empty task

Steps to reproduce:

  1. start the app
  2. create a task (say '123')
  3. double click on the created task to edit it (say you change it from '123' to '12345')
  4. press Enter to confirm the edition

Expected result: task in "non-edited" mode with the label '12345'

Actually observed: empty task

Refactor propHook to avoid using class + this (to support goal of thisless JavaScript)

Apologies for this pedantic nitpick. With that disclaimer, I found this repo after reading the Cycle.js homepage, where it says:

thisless JavaScript: The use of functions and RxJS Observables allow for a JavaScript programming style without the this keyword. Cycle.js encourages you to create apps with functional practices. Without this, you can write more reusable code and define logic without tightly coupling it to data. See it for yourself, this cannot be found in Cycle.js TodoMVC.

The current implementation of propHook uses this, so I thought I’d propose implementing that utility differently to validate the “thisless JavaScript” assertion.

Feature Request: Use cycle-history

Hi,

in my opinion it would be nice, if todomvc-cycle could use cycle-history instead of the more custom initialHash/hashchange. I'd expect to see how to use "offical" modules ("official" in the sense of "a module in the https://github.com/cyclejs organisation") in this example to check how they can be used together (e.g. what is an idiomatic Cycle application?).

Todo Item intent: `doneEdit` action is fired twice on `keyup:enter`

Hi,
At this point

DOM.select('.edit').events('keyup')
.filter(ev => ev.keyCode === ENTER_KEY)
.merge(DOM.select('.edit').events('blur', true))
.map(ev => ({title: ev.target.value, type: 'doneEdit'}))
)
keyup
and blur are fired when ENTER key is pressed. That way the model is written two times to localstorage.

How can we ignore blur event when keyup:ENTER is fired?
This should be done on intent or on model?

Sorry, I'm still learning RxJS.

todomvc-cycle becomes very slow with a lot of items (blocking script)

Hi,

First: congrats for the job done with cycle.js, I like the ideas behind this framework.

Now the problem I see is about a list with a lot of children observed by RxJS. In this todomvc example you can fill the localstorage with 2000 items, and see by yourself.

Here the way I produce the slowness by executing this in my developer tools and refreshing the page:

var store = { list: [] };
for (var i = 1; i <= 2000; i++) {
  store.list.push({ title: 'Todo' + i, completed: false, id: i });
}
localStorage.setItem('todos-cycle', JSON.stringify(store));

After this, complete a todo by clicking on it, and you can see a lot of scripting (mostly RxJS stuff):

screen shot 2016-01-23 at 17 43 41

Of course I think that 2000 todos is a little dumb :D, but maybe it make sense in another kind of app.

Question about the views

Congrats on your Framework, I followed the egghead tuts and i am very interested in the Cyclejs paradigm. So my question is: Can you use an abstraction/framework on the view layer so you don't have to write your view in JS ? I prefer writing them in plain html and using "something" to pass in the values and do the mutations... Is this possible with Cyclesjs ?

Question: How would you test the "Todos" component ?

Hi, I am new to cyclejs and Rx and, even if it completely twists my brain, I love it.

I am currently having a little problem with testing my components.
The case of a small independent component is, indeed, very easy to test. Simulating user interactions with the mockDOMSource cannot be easier :)
But when I am dealing with nested components, I am not sure how to do that in a nice clean way.

The case I am dealing with, is exactly the case of the Todos component in this repo. I have a component that renders a list of instances of a smaller component (eg the TodoItem). I don't really know how to test the destroy action for example.

The idea I came up with (which I am not very satisfied of) is to "publish"* the different part of the component (intent, model, view) and test every different aspect of the component separately. Then you can easily send action streams to the "model" part without having to mock user interactions.

The thing is, I like to think of my components as complete black boxes and it doesn't feel right to give "public" access to the different parts of the component.

So, I am asking you the question: how would you test the destroy action (or any other action from TotoItem that has consequence on the Todos component) ?

Thanks :)

*: publish might not be the correct word for it. When I say publish, I mean, either, exporting it in the component's module or splitting it in a separate module file so it can be imported latter on.

compose+merge = one output event?

I'm looking at a todo Intent and I see the input 'enter' key event stream get composed:

...
.compose(s => xs.merge(s, sources.DOM.select('.edit').events('blur', true)))
.map(ev => ({title: ev.target.value, type: 'doneEdit'}))

Why doesn't the map step not fire twice: once for the enter event and again for the merged DOM.select statement under the compose step? When I run the todo app in the debugger, I only see the map step called once... even though it looks like it should be called twice.

Alternative for route handling?

This line in src/intents/todos.js:

changeRoute$: Rx.Observable.fromEvent(window, 'hashchange')

breaks the concept of response observables comming from the user, I think that the hashchange event should come from the domDriver or other driver. It also makes testing hard, and adds a global reference that is not declared.

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.