Coder Social home page Coder Social logo

marionette-vdom's Introduction

marionette-vdom

Build Status Coverage Status npm version Davis Dependency status

A Marionette.View and Marionette.CompositeView implementation with virtual-dom.

Version

  • If you are using Marionette.js v3+ you should use marionette-vdom v0.2+ (or the latest)
  • If you are using Marionette.js v2 you should use marionette-vdom v0.1.2-b

Usage

This module exposes View as the VDOM implementation for Marionette.View and CompositeView for Marionette.CompositeView:

var VDOMView = require('marionette-vdom').View;
var VDOMCompositeView = require('marionette-vdom').CompositeView;

How tos

To install:

npm install

To run the demo app:

npm run demo
open http://127.0.0.1:9966/demo/demo.html

To run the perf test:

npm run perf
open http://127.0.0.1:9966/perf/perf.html

To run the unit tests:

npm test

To generate binaries:

./build.sh
uglifyjs --compress --mangle -- marionette.vdom.js > marionette.vdom.min.js

Make sure to check out the change log.

Browser support

IE 9 on

marionette-vdom's People

Contributors

gitter-badger avatar joshlasdin avatar megawac avatar nyamazing avatar samccone avatar terence1990 avatar themindfuldev 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  avatar  avatar  avatar

marionette-vdom's Issues

Bloated size?

Something seems very wrong with the size of this when you look at the size of marionette and the size of virtual-dom. There seems to be a lot of bloat being generated through browserify. I'm seeing Streams, Buffers, etc. in there and I would think none of this is needed, since mercury.js is almost 4x smaller when unminified files are compared.

No option to convert HTML with keys.

There is no option to convert HTML with keys in the attachElContent function.
If you are removing/adding/reordering elements these can get lost, and thus resulting in bad html.
In my project I fixed it now as following:

attachElContent: function(html) {

      var convertHTMLWithKey = convertHTML.bind(null, {
          getVNodeKey: function (attributes) {
              console.log(attributes)
              return attributes.id;
          }
      });

      var newVirtualEl = convertHTMLWithKey(this.rootTemplate({
        content: Backbone.$.trim(html)
      }));

      if (this.virtualEl) {
        var patches = diff(this.virtualEl, newVirtualEl);
        console.log(this.el, patches);
        patch(this.el, patches);
      }
      else {
        this.$el.html(Backbone.$.trim(html));
      }
      this.virtualEl = newVirtualEl;
      return this;
    },

Since attachElContent is called from the marionette code, you cannot add options. So still finding a correct way of fixing this.

YAVDOM

@TiagoRG, good work,
but please, see the code on https://github.com/AFASSoftware/maquette
code is < 11k minified, no-gzipped, supports transitions, real DOM / V-DOM merge, and it is fast
(your code is >250k, twice as React with addons?)

http://maquettejs.org/2015/02/28/Progressive-enhancement.html

From the site:

  1. Make the animation strategy pluggable thus allowing both velocityJS and CSS Transitions.
  2. Keep a reference to the rendered DOM node on virtual DOM nodes.
  3. Diffing and patching is done simultaneously.
  4. Virtual DOM nodes are considered immutable. This allows a powerful caching mechanism based on comparing object identity.

Keeping a reference to the rendered DOM on virtual DOM nodes is what makes maquette really
different from other implementations. I look forward to seeing what the performance implications of
this decision are and what other possibilities this enables like progressive enhancement.

Adapting a transpiler for ES6 or React templates must be easy, I'm working in ES6 and Mustache transpilers to vdom soon.

Is this module still recommended?

Hello @TiagoRG, thanks for taking the initiative in writing these ports from Marionette.ItemView and Marionette.CompositeView. I notice there hasn't been any updates in the last 11 months. Is this still a recommended method to improve performance in Backbone/Marionette apps, or are people moving to more a Marionette-React solution?

Thanks in advance for your response.

Support for LayoutViews

The only real view left! What do we need to do to support this? Any roadblocks I can help with?

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.