discourse/app/assets/javascripts/admin/addon
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
..
adapters
components DEV: Show active categories in form templates customize table (#20498) 2023-03-01 12:37:14 -08:00
controllers DEV: Support `@debounce` decorator in native class syntax (#20521) 2023-03-03 11:48:58 +00:00
helpers DEV: Remove 'htmlSafe' string prototype extensions (#16766) 2022-05-13 14:58:26 -05:00
lib DEV: Define form template field inputs (#20430) 2023-03-01 11:07:13 -08:00
mixins DEV: Clean up settings component (#20485) 2023-03-01 10:12:39 +01:00
models DEV: Define form template field inputs (#20430) 2023-03-01 11:07:13 -08:00
routes DEV: Clean up `showModal()` calls (#20442) 2023-02-24 15:53:04 +01:00
services UX: Redesign and refactor penalty modals (#19458) 2022-12-19 19:36:03 +02:00
templates REFACTOR: user directories without `<table>`, second attempt (#20515) 2023-03-02 15:10:19 -05:00