refactor: depend on scheduler directly in core instead of injecting via createRenderer

This commit is contained in:
Evan You
2018-09-21 13:34:00 -04:00
parent bb0e15de4d
commit de76daf073
11 changed files with 63 additions and 26 deletions

View File

@@ -11,3 +11,8 @@ The implementation of this module is inspired by the following prior art in the
- [Meteor Tracker](https://docs.meteor.com/api/tracker.html)
- [nx-js/observer-util](https://github.com/nx-js/observer-util)
- [salesforce/observable-membrane](https://github.com/salesforce/observable-membrane)
## Caveats
- Built-in objects are not observed except for `Map`, `WeakMap`, `Set` and `WeakSet`.

View File

@@ -235,5 +235,15 @@ describe('observer/collections', () => {
observed.get('key').a = 2
expect(dummy).toBe(2)
})
it('should observe iterated values (forEach)', () => {})
it('should observe iterated values (values)', () => {})
it('should observe iterated values (keys)', () => {})
it('should observe iterated values (entries)', () => {})
it('should observe iterated values (for...of)', () => {})
})
})

View File

@@ -158,6 +158,7 @@ const immutableInstrumentations: any = {
const target = unwrap(this)
const proto: any = Reflect.getPrototypeOf(target)
track(target, OperationTypes.ITERATE)
// TODO values retrived from iterations should also be observables
return proto[method].apply(target, args)
}
})