discourse/app/assets/javascripts
David Taylor 1b184cefd0
PERF: Update scrolling mixin implementation (#15109)
This mixin calls the "scrolled" method of some object with no parameters, so there is no way that consumers would ever call `event.preventDefault()`. Therefore we can make the listeners passive, and improve scrolling performance on mobile.

This commit also updates the mixin to remove JQuery usage. The API is slightly modified to remove the need for an event 'name' for binding/unbinding.

The calls to `.bindScrolling` and `.unbindScrolling` in user-stream.js are removed because they are already called by the LoadMore mixin which is applied to the component.

The `bindScrolling` method claimed to offer debouncing-by-default. However, a bug in the `opts` parsing meant that debouncing was skipped if a 'name' was passed in. Therefore the only consumer actually being debounced was the LoadMore mixin. This commit fixes the opts parsing, so all consumers get the same behavior.

However, when scrolling, debounce is rarely what we want. The documentation of `bindScrolling` says "called every 100ms". In fact, debounce means that the functions were only called 'after the user **stops scrolling** for 100ms'. If you're scrolling very slowly (e.g. when using momentum-based scrolling on mobile), then this can be quite frustrating. This is why "Load more" is only triggered on topics/topic-lists when you completely stop scrolling.

Therefore, this commit also replaces the default 'debounce' with a 'throttle'. The 'throttle' is configured with `immediate = false`, so that it fires on the trailing edge, and therefore the final call will always be **after** we finish scrolling. (the default `immediate: true` would fire on the leading edge, and so the last call could be up to 100ms **before** we finish scrolling).
2021-11-26 20:22:50 +00:00
..
admin DEV: Re-allow node 17, with a warning (#15083) 2021-11-24 21:16:33 +01:00
confirm-new-email DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
discourse PERF: Update scrolling mixin implementation (#15109) 2021-11-26 20:22:50 +00:00
discourse-common DEV: Make @afterRender do just that, no extra next() (#15086) 2021-11-26 20:16:08 +01:00
discourse-hbr DEV: Re-allow node 17, with a warning (#15083) 2021-11-24 21:16:33 +01:00
discourse-widget-hbs DEV: Re-allow node 17, with a warning (#15083) 2021-11-24 21:16:33 +01:00
docs DEV: enforces eslint’s curly rule to the codebase (#10720) 2020-09-22 16:28:28 +02:00
ember-addons DEV: Remove ember-addons (#9559) 2020-04-28 10:14:49 -04:00
locales DEV: Use method definition syntax consistently (#14915) 2021-11-13 14:01:55 +01:00
pretty-text DEV: Re-allow node 17, with a warning (#15083) 2021-11-24 21:16:33 +01:00
select-kit DEV: Re-allow node 17, with a warning (#15083) 2021-11-24 21:16:33 +01:00
truth-helpers DEV: Re-allow node 17, with a warning (#15083) 2021-11-24 21:16:33 +01:00
wizard DEV: Avoid using globals (#14909) 2021-11-13 13:10:13 +01:00
.npmrc DEV: Prevent npm usage (#13945) 2021-08-04 22:04:58 +02:00
activate-account.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
admin.js.erb FIX: Load .js files from plugins in qunit testing env (#11304) 2020-12-03 10:25:42 -06:00
app-boot.js REFACTOR: Sync up master with changes for Ember-CLI (#11671) 2021-01-12 10:13:21 -05:00
application.js DEV: Make screen-track a regular service (#14983) 2021-11-17 20:56:06 +01:00
auto-redirect.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
browser-detect.js FIX: Feature detect globalThis (#14410) 2021-09-22 11:39:41 -03:00
browser-update.js FIX: browser-update should work with old browsers (#12436) 2021-03-18 19:09:01 +02:00
discourse-loader.js Revert "A11Y: Improve create account modal for screen readers (#14204)" (#14233) 2021-09-03 09:42:56 +10:00
discourse-shims.js FEATURE: Local chunked uppy backup uploads with a new uploader plugin (#14894) 2021-11-23 08:45:42 +10:00
embed-application.js DEV: prettier 2.2.1 (#11862) 2021-01-27 12:39:20 +01:00
ember_include.js.erb
ember_jquery.js Revert "Revert "DEV: Import MessageBus from message-bus-client instead of globals"" 2020-05-28 08:42:36 -04:00
env.js FIX: attempts to fix an error with EXTEND_PROTOTYPES (#7067) 2019-02-26 11:04:05 +01:00
google-tag-manager.js FEATURE: Implement nonces for Google Tag Manager integration (#12531) 2021-03-26 11:19:31 -04:00
google-universal-analytics-v3.js FEATURE: Add Google Universal Analytics v4 as an option (#11123) 2020-11-06 14:15:36 -06:00
google-universal-analytics-v4.js FEATURE: Add Google Universal Analytics v4 as an option (#11123) 2020-11-06 14:15:36 -06:00
handlebars-shim.js FIX: It seems sometimes shims are evaluated by older JS engines (#11813) 2021-01-22 10:41:01 -05:00
main_include_admin.js REFACTOR: Support bundling our admin section as an ember addon 2020-09-22 15:14:29 -04:00
markdown-it-bundle.js REFACTOR: Do not rely on module order for discourse-markdown loading 2020-09-18 13:31:55 -04:00
onpopstate-handler.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
package.json FIX: Make truth-helpers work in Ember CLI (#13044) 2021-05-12 17:52:36 +02:00
polyfills.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
pretty-text-bundle.js FIX: pretty text allow list (#10977) 2020-10-28 13:22:06 +11:00
print-page.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
service-worker.js.erb DEV: debug: false for service workers to stop log spam via workbox (#12093) 2021-02-16 14:01:19 +10:00
set-prototype-polyfill.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
start-discourse.js DEV: Avoid using globals (#14909) 2021-11-13 13:10:13 +01:00
template_include.js DEV: Support for import Handlebars from 'handlebars'; (#9600) 2020-04-30 16:41:02 -04:00
test-shims.js DEV: Migrate to Ember CLI (#11932) 2021-02-03 14:22:20 -05:00
vendor.js DEV: uses forked Mousetrap to avoid leaking listeners (#14198) 2021-09-08 14:48:13 +02:00
widget-runtime.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
wizard-application.js DEV: implements some of ember-truth-helpers (#12667) 2021-04-12 11:40:00 +02:00
wizard-shims.js FIX: adds shims for popper in wizard (#10658) 2020-09-14 12:33:14 -04:00
wizard-start.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
wizard-vendor.js DEV: Remove ember_jquery in most situations (#13237) 2021-06-01 15:32:51 -04:00
yarn.lock FEATURE: Support i18n in Ember CLI plugin tests 2021-11-24 15:19:36 -05:00