Coder Social home page Coder Social logo

elmo's Introduction

elmo - A cyclic elm architectured framework.

help maintain this lib

ELMo riding a HellCycle down to Inferno

About

Elmo is my experiment with trying to unify some concepts from two of my favourite Javascript projects: Cycle and Elm. I tend to learn by doing, and this experiment is helping me understand better how both Cycle and Elm are designed and work.

Cyclic

Like Cycle, Elmo uses reactive streams to transform data all the way down, and everything flows by combining those streams using just pure functions.

Elmo has its own Cycle.run function named HellCycle used to connect the side-effect-free Elmo Components (things you write like counter app) with effect-producing drivers. Now, being this an experiment, I just wanted to implement my own ten-lines cycle.

In theory, it's possible to use any Cycle Driver with Elmo, as they have the same interface - it's something I'm planning to experiment with these days, and maybe extracting the Elmo Driver, so you could implement Elm-architectured components with Cycle.

Elmo has a tiny stream adaptor around Flyd, but I expect to experiment with other libraries or even use Cycle's own stream adaptor.

Elmo has a driver for the Inferno rendering library. I'll try to implement something like TodoMVC with Elmo and see how that benchmarks. Also, it'd be nice to have a Cycle driver to render with Inferno.

Elmo, as its name implies, tries to follow the Elm Architecture, so every component exposes init, update, view functions along with their Msg and Model definitions. I'm planning to implment elmish like Cmd and Subscription to communicate with other existing cyclic drivers.

However, instead of calling the update or view functions everytime, Elmo follows the reactive way: having those functions receive and return streams for when data needs to be changed.

The view (in the example counter app implemented with Inferno's jsx) for example, returns an stream of Inferno DOM nodes to be updated on the browser by the Inferno Driver

functional

I did try to keep things as pure and functional as possible - Elmo itself uses Ramda extensively to achieve this.

One thing I've found interesting on exploring is having the Elmo Component's update and view functions not having direct access to the model's object. Instead, the view has read-only access to lens of the current model. Even the update function is given lenses for getting, setting and updating while keeping data immutable, the new data returned by update lenses becomes the new model. It is of course possible to get the actual model object inside those functions, but I just didnt want to make that obvious, and trying to hide it to prevent object mutation.

The example counter can be seen here

To be continued...

elmo's People

Contributors

vic avatar zuraguerra avatar

Stargazers

Sean Hagstrom avatar Josh Burgess avatar Davo avatar Stefan avatar Ivan Dmitriev avatar Dominic Gannaway avatar

Watchers

James Cloos avatar Dominic Gannaway avatar  avatar

Forkers

zuraguerra

elmo's Issues

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.