-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Memory-ish protocol #44
Conversation
context: we use this in an Electron app where there is no url bar, the session storage is so ctrl-r works |
598857d
to
6707406
Compare
I updated the code a bit. How does this look? |
src/MemoryProtocol.js
Outdated
|
||
// Checking instanceof Array is okay because we make the array. | ||
if ( | ||
stack instanceof Array && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still weird :P what's wrong with isArray?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requires a polyfill for older browsers, no? i don't have babel-runtime here... not sure what the right thing is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how far back are you going? isArray
is ie9+
...this._stack[this._index], | ||
action: 'POP', | ||
index: this._index, | ||
delta, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I originally did this sticking index and delta on location, but what's the value in doing so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in principle for consistency with browser protocol... e.g. if you want to animate differently based on whether delta is positive or negative
not sure if index has any purpose... really just from remix-run/history#36 and remix-run/history#334
Good to go on my end |
lgtm |
Admittedly this is more of a SessionProtocol, It’s probably easy to write a pure memory one in terms of the this, but meh