-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
dtlaunch: remember page between dtlaunch instances #3642
Conversation
hm, the linter doesn't seem to handle |
It feels like this adds just enough milliseconds to be noticable when switching back and forth to the clock. Feels a little less snappy. Might do some timings to compare. |
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.
I like the idea! Just a few questions about where we store variables
apps/dtlaunch/app-b2.js
Outdated
|
||
this.page = page; | ||
}; | ||
Bangle.dtHandlePagePersist(page); |
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.
Similarly to the this
thing above, do we want to chuck this onto Bangle
, or perhaps we just have an unrelated global object we use instead?
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.
Maybe that's better!
Should I do it by e.g. global.dtlaunch = {}; global.dtlaunch.handlePagePersist = ()=>{...}
?
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.
Nice, yeah I think that'll work great - and if you make it
global.dtlaunch.handlePagePersist = function() {...}
// ^~~~~~~~
then when you call it as dtlaunch.handlePagePersist()
, then you can use this
exactly as you intended (as this == dtlaunch
)
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.
Nice - perhaps we want to camelCase the function to keep with the existing pattern? (handlePagePersist
instead of HandlePagePersist
)
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.
Yes - just noticed that as well 👍
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.
Nice, yeah I think that'll work great - and if you make it
global.dtlaunch.handlePagePersist = function() {...} // ^~~~~~~~then when you call it as
dtlaunch.handlePagePersist()
, then you can usethis
exactly as you intended (asthis == dtlaunch
)
Interesting! So that's a difference between function() {...}
and () => {...}
?
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.
... also is the global
at the beginning in your suggestion required as well?
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.
Yes exactly - () => ...
won't have its own this
, it just uses one from up a level, whereas function
s always have their own this
. Also no, the global
at the start of my suggestion isn't needed, nice spot
What you have now looks great btw!
Measuring performance on non-pretokenized code: Time to first draw: 438 ms -> 441 ms (shouldn't be noticable, I guess I placeboed myself) Time until the whole file has run: 600 ms -> 615 ms |
The global dtlaunch object contains function and information to restore the page between instances of dtlaunch.
Here we go! |
@bobrippling interested what you think about this!
Available on https://thyttan.github.io/BangleApps/?id=dtlaunch