Last active
August 29, 2015 14:10
-
-
Save TomoyaShibata/38ab60754408e3ae6639 to your computer and use it in GitHub Desktop.
Backbone.View 間で共有したい、永続化しない Model。 "Mediator" という名付けがそもそも正しいのかは微妙なことと、こういう共有の方法で問題ないのかがちょっと不明。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.Mediator.Model.Hoge = _.extend(Backbone.Model.prototype, { | |
title: 0, | |
name : 0, | |
// Viewは意図的に殺すので、監視ではなくViewがメソッドを呼ぶイメージ | |
changeTitle: function(title) { | |
this.title = title; | |
this.trigger('changedTitle'); | |
}, | |
// Viewは意図的に殺すので、監視ではなくViewがメソッドを呼ぶイメージ | |
changeName: function(name) { | |
this.name = name; | |
this.trigger('changedName'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment