Repository navigation
Improve feature loading mechanism - #2987
Merged
Merged
Conversation
No more monolithic `init` function
Member
Author
|
@sindresorhus @yakov116 it'd be great if you could use this for a few days. It looks like it's working for me, but I haven't specifically tested the features that were "updated" the most. |
`deinit` functions used to be called on every single pageload. Now they're called only once after the feature ran.
Member
|
@fregante I have very limited access to a computer over the next week but I will try it and let you know how it goes. |
Both in lists (was already broken) and when loading a discussion that was marked as unread.
Member
@fregante what things specifically should i test? |
Member
Author
This was referenced Apr 12, 2020
fregante
marked this pull request as ready for review
April 14, 2020 22:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


New attempt at solving this: #2925 (comment)
WIP: I'll have to review this code again and do a couple of new TODOs
Why
onNewComments,onNewsfeedLoad, etc.onAjaxedPagesinternally.onAjaxedPagesmean anyway?)Changes
By default, run on DOM ready and AJAX pages.
You can customize this behavior with 3 separate options:
waitForDomReady: true: "fast features" will have to set this to false.repeatOnAjax: true: It's the most common configuration anyway. It only has to be set tofalsein rare occasions.repeatOnAjaxEvenOnBackButton: false: this the equivalent of the oldonAjaxedPagesRaw. Only used by 3 features.Pass additional listeners via
additionalListeners: []property. These listeners will be run after each page load, whether this is "document start", DOM ready or AJAX.