File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,23 @@ class TrackedValue<T> {
54
54
* @use search = RemoteData(() => `https://my.domain/search?q=${this.debouncedInput}`);
55
55
* }
56
56
* ```
57
+ *
58
+ * @example
59
+ * An initialize value can be provided as the starting value instead of it initially returning undefined.
60
+ * ```js
61
+ * import Component from '@glimmer/component';
62
+ * import { tracked } from '@glimmer/tracking';
63
+ * import { use } from 'ember-resources';
64
+ * import { debounce } from 'reactiveweb/debounce';
65
+ *
66
+ * const delay = 100; // ms
67
+ *
68
+ * class Demo extends Component {
69
+ * @tracked userInput = 'products';
70
+ *
71
+ * @use debouncedInput = debounce(delay, () => this.userInput, this.userInput);
72
+ * }
73
+ * ```
57
74
*
58
75
* @param {number } ms delay in milliseconds to wait before updating the returned value
59
76
* @param {() => Value } thunk function that returns the value to debounce
You can’t perform that action at this time.
0 commit comments