Closed justinbmeyer closed 6 years ago
I made a pre-release between can-fixture versions 1.1.1 and 1.1.2 which had a standalone memory connection. It didn't get merged into the mainline versions, but it can be used as a reference point for future work: https://github.com/canjs/can-fixture/blob/v1.1.2-pre.1/memoryConnectionStandalone.js
Of particular note is the set of utility functions that appear at the top of the file linked above. Those are from can-connect and would also need to be pulled out into a utility library.
made can-memory-store which is used by can-fixture directly
can-connect
depends oncan-fixture
which depends oncan-connect
. This makes upgrading hard. I'd like to fix this for the next major release. The shared dependency isdata/memory-cache
.There are a few options on how to separate
memory-cache
:Pull out memory cache as a behavior/mixin
memory-cache
is a behavior/mixin defined like:This means, it expects to have access to other properties and methods up its prototype chain.
If we wanted to keep this the same we would probably make a
can-mixin
package that would do the same thing asconnect.behavior
. Thencan-memory-cache
would be one of these mixins:This means to use
can-memory-cache
, you need to call the mixin like:Make the mixin itself
Pull out memory-cache as its own thing
Instead of creating memory-cache as a mixin, it could be just a function that must be passed everything it needs:
For this to be used in
can-connect
, it would effectively need to do something like:This basically traps the
this
of agetListData
call, and makes sure that all reads onoptions
read from thatthis
.