Backbone と競合状態になる可能性があります。
ユーザーが左側のリンクを前後にクリックすると、最終的にネストされたビューが表示されます。
これは通常、ワンクリックがまだビューをロードしているときに発生します。
http://screencast.com/t/oLsZQga1
これを修正するために私ができる簡単なことはありますか?_.debounce() を使用してみましたが、これはローカルでうまく機能しますが、実際のデータを使用してテスト環境に入れると、ネストされたビューが再び取得され始めます。
EDIT:いくつかのコードがおそらく役立つでしょう;)。
これは、左側の 2 つのリンクのビューです。
events:
"click" : "close"
initialize: =>
super
@close = _.debounce @_close, 1500, true
_close: (e) =>
e.preventDefault() if e
e.stopPropagation() if e
id = @model.get('_id') || @model.get('id')
@publishEvent "!router:route", "fan/#{id}"
これは、右側の結果のビューです。
attach: ->
super
$(".fanViewButton").parents("li:first").addClass("active")
@initSubViews()
@updateFanHistory()
initSubViews: ->
@subview("memberDataView", new GeneralInfo({container:'div.left .row-fluid', model:@model}))
@subview("fanHand", new FanHand({container: @$el.find('.fanHandContainer'), model: @model}))
@subview("gatherInfo", new GatherInfo({container: @$el.find('.gatherInfoContainer'), model: @model}))
@subview("fanScores", new FanScores({container:@$el.find('.center .row-fluid'), model : @model}))
@setHeight()
私は Backbone を初めて使用するので、さらに情報が必要な場合はお知らせください。
みんな、ありがとう :)。