Skip to content

Instantly share code, notes, and snippets.

@hell0again
Created September 17, 2014 02:48
Show Gist options
  • Save hell0again/e6c8606328f5925aa980 to your computer and use it in GitHub Desktop.
Save hell0again/e6c8606328f5925aa980 to your computer and use it in GitHub Desktop.
backboneでcomputedな属性を実現するためのpluginども

setterがあったりなかったりgetterへのdependsの渡し方ら辺で差が出てる。 人気なのはepoxyっぽいけどobjectではなくjsonで設定を渡すのがキモい。

使うかもしれない

おなまえ リポジトリ 小並感
backbone-computedfields https://github.com/alexanderbeletsky/backbone-computedfields Inspired by backbone.compute。get, set, dependsとかで定義。いま使ってる
Backbone.ModelMorph https://github.com/rhysbrettbowen/Backbone.ModelMorph get, set, requireとかのメソッドで定義。lodashの互換性は要確認
backbone-computed https://github.com/blackwoodseven/backbone-computed dependsとsetterまわりがどうなってるか要確認

使わない

おなまえ リポジトリ 小並感
backbone.epoxy https://github.com/gmac/backbone.epoxy 人気っぽくて開発も活発。ただ "value:firstName,events:['keyup']" みたいに設定をjsonで書かせるのが
Backbone.Spark https://github.com/phdesign/Backbone.Spark 関数を渡してdependsOnで依存を足す感じ。アクセッサはarguments.lengthで判別して個別に定義する模様
backbone.model.computed https://github.com/kdocki/backbone.model.computed modelに getFullName みたいな関数を生やして get('full_name') みたいな
Backbone.ComputedModel https://github.com/steve8708/Backbone.ComputedModel ['productList', (productList) -> ... みたいにrequireライク。でもなぜかArray。setterはどこに
backbone.compute https://github.com/derickbailey/backbone.compute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment