feat(scope): new and improved scope implementation

- Speed improvements (about 4x on flush phase)
- Memory improvements (uses no function closures)
- Break $eval into $apply, $dispatch, $flush
- Introduced $watch and $observe

Breaks angular.equals() use === instead of ==
Breaks angular.scope() does not take parent as first argument
Breaks scope.$watch() takes scope as first argument
Breaks scope.$set(), scope.$get are removed
Breaks scope.$config is removed
Breaks $route.onChange callback has not "this" bounded
This commit is contained in:
Misko Hevery
2011-03-23 09:33:29 -07:00
committed by Vojta Jina
parent 1f4b417184
commit 8f0dcbab80
60 changed files with 2539 additions and 1721 deletions

View File

@@ -16,7 +16,7 @@ describe('$cookieStore', function() {
it('should serialize objects to json', function() {
$cookieStore.put('objectCookie', {id: 123, name: 'blah'});
scope.$eval(); //force eval in test
scope.$flush();
expect($browser.cookies()).toEqual({'objectCookie': '{"id":123,"name":"blah"}'});
});
@@ -30,12 +30,12 @@ describe('$cookieStore', function() {
it('should delete objects from the store when remove is called', function() {
$cookieStore.put('gonner', { "I'll":"Be Back"});
scope.$eval(); //force eval in test
scope.$flush(); //force eval in test
$browser.poll();
expect($browser.cookies()).toEqual({'gonner': '{"I\'ll":"Be Back"}'});
$cookieStore.remove('gonner');
scope.$eval();
scope.$flush();
expect($browser.cookies()).toEqual({});
});
});