Skip to content
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

Make Refined GitHub act sooner with element-ready #2604

Closed
fregante opened this issue Dec 7, 2019 · 0 comments · Fixed by #2605
Closed

Make Refined GitHub act sooner with element-ready #2604

fregante opened this issue Dec 7, 2019 · 0 comments · Fixed by #2605
Labels
meta Related to Refined GitHub itself under discussion

Comments

@fregante
Copy link
Member

fregante commented Dec 7, 2019

The browser may display content on screen long before dom-ready, so sometimes content appears for a few seconds before Refined GitHub changes it. This is a bit annoying.

https://github.com/sindresorhus/element-ready can avoid this by acting on elements as soon as they appear in the DOM while the page is still loading/streaming.

GitHub sometimes loads new pages via ajax so we have to listen to both the real dom-ready event and the ajaxed one. We handle this with features.onAjaxedPages

We use element-ready in some features but there's currently no loading mechanism that combines element-ready and ajaxed loads.

Possible solutions

Here's some implementations I thought of.

A new single loading method

feature.init({
	...,
	load: features.onAjaxedPagesOrWait('selector')
});

Better yet, have a onAjaxedPages version that doesn't wait for dom-ready on the first run and element-ready can be used in the feature itself.

✅ Preferred

feature.init({
	...,
	load: features.onAjaxedPagesOrInstant
});

A completely new loading API

This would split each event and allow us to combine them in any way, but it's a bit verbose

feature.init({
	...,
	loadOnAjaxed: true,
	loadAfterElement: 'selector'
});

this means regular features (dom-ready + ajaxed) would have to be declared explicitly:

feature.init({
	...,
	loadOnDomReady: true,
	loadOnAjaxed: true
});

... other suggestions welcome

@fregante fregante added help wanted meta Related to Refined GitHub itself under discussion Please! ♥︎ Particularly useful features that everyone would love! has PR and removed Please! ♥︎ Particularly useful features that everyone would love! help wanted labels Dec 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Related to Refined GitHub itself under discussion
Development

Successfully merging a pull request may close this issue.

1 participant