Slide 58
Slide 58 text
[...]
testNotifyWithMultipleWhatchesNested: function(){!!
! ! var a = 0, b = 0, c=0;!
! ! _$.watch('testNotify', function(memo){
a = memo.test;
! ! ! _$.watch('testNotify', function(memo){
! ! ! ! if (b<2){ b = memo.test; }
else { c = memo.test; }
! ! ! });
! ! });
! !
! ! _$.notify('testNotify', {test: 1});
! ! assertEquals(1, a);
! ! assertEquals(0, b);
! ! assertEquals(0, c);
! !
! ! _$.notify('testNotify', {test: 2});
! ! assertEquals(2, a);
! ! assertEquals(2, b);
! ! assertEquals(0, c);
! !
! ! _$.notify('testNotify', {test: 3});
! ! assertEquals(3, a);
! ! assertEquals(2, b);
! ! assertEquals(3, c);
! },
[...]