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
warn if a mismatched global session is present (fix #47) #52
base: master
Are you sure you want to change the base?
Conversation
// The name of the property encodes the session/node compatibilty version | ||
if (!global._heimdall_session_3) { | ||
global._heimdall_session_3 = new Session(); | ||
} | ||
|
||
for (let i = 1; i < 3; i++) { |
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.
Might be unnecessary, but we could do const CURRENT_VERSION = 3;
in the module scope and replace 3
everywhere with the constant so that future upgrades are easy.
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.
Agree, makes what's going on here more intuitive.
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.
fixed
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.
Basic approach seems fine although TBH i think it would be clearer to just unroll the loop. We really don't plan on bumping the session version often.
if ('_heimdall_session_1' in global || '_heimdall_session_2' in global) {
//warn
}
Also tests.
global[CURRENT_SESSION_KEY] = new Session(); | ||
} | ||
|
||
for (let i = 1; i < CURRENT_VERSION; i++) { |
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.
needs test
This may have gone stale, do we want this still? |
@stefanpenner i think we do; it should be an indication to upgrade certain deps |
No description provided.