discourse/app/assets/javascripts/discourse-common/addon/utils
David Taylor e08a0b509d
DEV: Support @debounce decorator in native class syntax (#20521)
The implementation previously generated a descriptor with an `initializer()`, and bound the function to the `this` context of the initializer. In native class syntax, the initializer of a descriptor is only called once, with a `this` context of the constructor, not the instance.

This commit updates the implementation so that it generates the bound function on-demand using a getter. This is the same strategy employed by ember's built-in `@action` decorator.

Unfortunately, this use of a getter means that the `@observes` decorator does not support being directly chained to `@debounce`. It throws the error "`observer must be provided a function or an observer definition`". The workaround is to put the observer on its own function, which then calls the debounced function. Given that we're aiming to reduce our usage of `@observes`, we've accepted the need for this workaround rather than spending the time to patch the implementation of `@observes`.
2023-03-03 11:48:58 +00:00
..
category-macro.js FEATURE: Display pending posts on user’s page 2021-11-29 10:26:33 +01:00
decorator-alias.js DEV: Use method definition syntax consistently (#14915) 2021-11-13 14:01:55 +01:00
decorators.js DEV: Support @debounce decorator in native class syntax (#20521) 2023-03-03 11:48:58 +00:00
dom-utils.js DEV: drops jquery from scrolling-post-stream (#15313) 2021-12-17 14:52:42 +01:00
escape-regexp.js DEV: Add escapeRegExp util (#17051) 2022-06-10 10:37:54 +10:00
extract-value.js
handle-descriptor.js FIX: In prod builds classes may not be "instancesof" EmberObject (#18137) 2022-08-30 17:36:20 +02:00
is-descriptor.js
macro-alias.js DEV: Add unique ids to deprecations (#19019) 2022-11-16 10:00:39 +00:00
watched-words.js FEATURE: Add support for case-sensitive Watched Words (#17445) 2022-08-02 10:06:03 +02:00