@@ -25,35 +25,33 @@ function Binding (compiler, key, isExp, isFn) {
2525var BindingProto = Binding . prototype
2626
2727/**
28- * Process the value, then trigger updates on all dependents
28+ * Update value and queue instance updates.
2929 */
3030BindingProto . update = function ( value ) {
31- this . value = value
32- batcher . queue ( this , 'update' )
31+ if ( arguments . length ) this . value = value
32+ batcher . queue ( this )
3333}
3434
35+ /**
36+ * Actually update the instances.
37+ */
3538BindingProto . _update = function ( ) {
36- var i = this . instances . length
39+ var i = this . instances . length ,
40+ value = this . eval ( )
3741 while ( i -- ) {
38- this . instances [ i ] . update ( this . value )
42+ this . instances [ i ] . update ( value )
3943 }
4044 this . pub ( )
4145}
4246
4347/**
44- * -- computed property only --
45- * Force all instances to re-evaluate themselves
48+ * Return the valuated value regardless
49+ * of whether it is computed or not
4650 */
47- BindingProto . refresh = function ( ) {
48- batcher . queue ( this , 'refresh' )
49- }
50-
51- BindingProto . _refresh = function ( ) {
52- var i = this . instances . length
53- while ( i -- ) {
54- this . instances [ i ] . refresh ( )
55- }
56- this . pub ( )
51+ BindingProto . eval = function ( ) {
52+ return this . isComputed && ! this . isFn
53+ ? this . value . $get ( )
54+ : this . value
5755}
5856
5957/**
@@ -63,7 +61,7 @@ BindingProto._refresh = function () {
6361BindingProto . pub = function ( ) {
6462 var i = this . subs . length
6563 while ( i -- ) {
66- this . subs [ i ] . refresh ( )
64+ this . subs [ i ] . update ( )
6765 }
6866}
6967
0 commit comments