Spruced it up a little bit with some location tracking. The approach doesn't change from how you held onto tracking objects, other than creating a sibling location object to track. It's set up like this:
filters = {
trackings: {}, // same as before, just now part of filters, and sibling of locations
locations: {}
}
track() is now abstracted by addFilter, which is now used by both track() and location()
untrack() is now abstracted by removeFilter, which is now used by both untrack() and unlocate()
connect() checks if there are eitherlocation or tracking filters before connecting.
Spruced it up a little bit with some location tracking. The approach doesn't change from how you held onto
tracking
objects, other than creating a siblinglocation
object to track. It's set up like this:track()
is now abstracted byaddFilter
, which is now used by bothtrack()
andlocation()
untrack()
is now abstracted byremoveFilter
, which is now used by bothuntrack()
andunlocate()
connect()
checks if there are eitherlocation
ortracking
filters before connecting.Also added a couple tests for it.
:)