GithubHelp home page GithubHelp logo

rstankov / backbone-bind-to Goto Github PK

View Code? Open in Web Editor NEW
81.0 81.0 3.0 355 KB

Backbone.js extension for automatic binding and unbinding of model events to views.

License: Other

CoffeeScript 91.97% HTML 8.03%

backbone-bind-to's People

Contributors

korbin avatar rstankov 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

Watchers

 avatar  avatar  avatar  avatar  avatar

backbone-bind-to's Issues

_binded array is cleaned up if bindTo is used more than once per objects other than this.model & this.collection + little more improvements as gist

Hi Stankov :)
See this https://github.com/RStankov/backbone-bind-to/blob/master/src/backbone_bind_to.coffee#L21

Looks like when I call bindTo more than once like:

this.bindTo(this.model.myCollection, "reset", "render");
this.bindTo(this.model.myOtherCollection, "reset", "render");

it will clean up all the _binded values, please correct me if I'm wrong.

Also I've used your library but with little modifications as they were naturally useful in my own case, you can take a look on the raw javascript (sorry, didn't had enough time to get them back to coffee) at this link:

https://gist.github.com/4215860

in general:

  • bindTo supports functions for handlers, not only strings
  • unbindAllOnRemove method for removing any binds to an object on remove, just a helper
  • unbindAll method for the logic to unbind all handlers to current _binded array as well as from the model / collection
  • lastly a dirty hack to execute the plugin in window context, as I'm using browserify for asset pipelines which includes every single file in its own CommonJS-like scope.

Hope that helps. Your plugin works quite well, now we have no leaks or strange side effects. Credits to follow ;)

Comments say "Backbone Handlebars"

Great work - Thanks for making this available! One small detail... the comments say "Backbone Handlebars" instead of "Backbone BindTo". Didn't seem worth forking, but worth mentioning.

Cheers,
Chip

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.