Giter VIP home page Giter VIP logo

ractive-adaptors-backbone's People

Contributors

anton-ryzhov avatar bartsqueezy avatar fasterthanlime avatar hippich avatar martinkolarik avatar martypdx avatar rich-harris avatar rstacruz 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

Watchers

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

ractive-adaptors-backbone's Issues

Ractive `event.context` is not a backbone model

It used to be that the event.context of a Ractive proxy event contained the backbone model. Now it just contains a plain object with the model properties. However, if I call this.get(event.keypath) then I do get a backbone model.

It seems to me that event.context should contain the backbone model and not just the properties.

Collection sort

Hi. This adaptor is pretty great and very helpful for our projects.

I am running into an issue where calling a .sort() on a collection does not prompt Ractive to re-render the HTML. The collection is indeed resorted, but this is not reflected in the DOM. Even with a manual ractive.update() call, no changes.

I will work on making a JSFiddle to make this reproducable, but i just wanted to start the thread to see if there was something obvious I was missing.

Missing `main` property in package.json

Ideally, I should be able to put require('ractive-backbone') in my app, but with a main property or an index.js, I need to instead use `require('ractive-backbone/Racktive-Backbone').

Push to npm

Would be great to do after 0.2.0 once we've merged outstanding PRs.

Merge operations

Ractive has a ractive.merge() operation which minimises the amount of DOM manipulation involved in updating list sections. It should be possible to use the same logic with Backbone collections.

ractive and backbone need to be peer dependencies

ractive and backbone need to be under peerDependencies.

It might not work in browserify otherwise. x instanceof Backbone.Model may check x against a new instance of Backbone from the one the user's probably already using.

Backbone Models have no method `reset`

Hello, I have found a bug that seems to only surface in very rare instances. Under the reset method for models, this.value.reset( object ); is used. Since this.value is a Backbone model, calling reset() will most certainly fail. I fixed this by replacing the whole function with return false;. This might not be desirable, so instead perhaps this.value.clear().set(object); would be better?

Ditch grunt

Grunt for a 180-line library may be overkill. Since moving from qunit to mocha, the only functions grunt fulfills today is (1) jshint, and (2) uglifyjs compression.

My suggestions:

  • include jshint testing as part of the test suite. I think this is great because any open PRs will be tested against the test suite via Travis, hence checking PR's against jshint as well. This can be done via scripts: { test: "jshint ractive-adaptors-backbone.js && mocha" } or mocha-jshint.
  • use npm run prepublish to minify the js file. The prepublish hook is the npm standard for invoking build steps. This is done by adding { scripts: { prepublish: "uglifyjs -m < index.js > index.out.js" } } to package.json.
  • finally, remove dependency on grunt.

Nested collections recurse infinitely

When a wrapped backbone collection contains a second backbone collection, the reset call of the ractive-adaptor blows the call stack :(

http://jsfiddle.net/va6jU/46/

Looks like the collection is wrapped twice. One time through misses the this.setting check and gets .reset. Which seems like it would be fine, except the this.value.reset( models ) triggers a 'reset' event, which triggers the collection wrapper to reset again (and again, and again).

Adding {silent: true} seems to fix this. That might be covering a symptom though.

reseting a model to a collection is not accounted for

Consider:

ractive.set( 'x', new Backbone.Model() );
ractive.set( 'x', new Backbone.Collection() );

This will treat the collection as a POJO and attempt to extend the model with it. That is:

// this doesn't make sense
model.set({ length: 0, models: [], _byId: {} });

Updating a collection could probably use merge

There are some pros and cons to mergeing as opposed to seting as is currently done here. A con would be performance is better with a set, and a pro would be that elements would transition properly with merge.

Prior to 0.8, it was impossible to merge an array with itself, so it may not be wise to do so until 0.7 and earlier are mostly out of use. See ractivejs/ractive#2203

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.