|
3 | 3 | * components to make it easy to use TinyTick in a React application. |
4 | 4 | * |
5 | 5 | * The hooks in this module primarily provide access to the data and structures |
6 | | - * exposed by an TinyTick Manager, as initialized by the ManagerProvider |
7 | | - * component. |
| 6 | + * exposed by an TinyTick Manager, as initialized by the Provider component. |
8 | 7 | * @packageDocumentation |
9 | 8 | * @module ui-react |
10 | 9 | * @since v1.1.0 |
11 | 10 | */ |
12 | 11 | /// ui-react |
13 | 12 |
|
14 | 13 | /** |
15 | | - * The useManager hook returns the Manager provided by the a ManagerProvider |
16 | | - * component. |
| 14 | + * The useManager hook returns the Manager provided by the a Provider component. |
17 | 15 | * @returns The current Manager, or `undefined` if called from outside an active |
18 | | - * ManagerProvider. |
| 16 | + * Provider. |
19 | 17 | * @example |
20 | | - * This example gets the Manager from the ManagerProvider component. |
| 18 | + * This example gets the Manager from the Provider component. |
21 | 19 | * |
22 | 20 | * ```jsx |
23 | 21 | * import React from 'react'; |
24 | 22 | * import {createRoot} from 'react-dom/client'; |
25 | | - * import {ManagerProvider, useManager} from 'tinytick/ui-react'; |
| 23 | + * import {Provider, useManager} from 'tinytick/ui-react'; |
26 | 24 | * |
27 | 25 | * const App = () => ( |
28 | | - * <ManagerProvider> |
| 26 | + * <Provider> |
29 | 27 | * <Pane /> |
30 | | - * </ManagerProvider> |
| 28 | + * </Provider> |
31 | 29 | * ); |
32 | 30 | * const Pane = () => ( |
33 | | - * <span>{useManager().getNow()}</span> |
| 31 | + * <span>{useManager()?.getStatus()}</span> |
34 | 32 | * ); |
35 | 33 | * |
36 | 34 | * const app = document.createElement('div'); |
37 | 35 | * createRoot(app).render(<App />); // !act |
38 | 36 | * console.log(app.innerHTML); |
39 | | - * // -> '<span>["color"]</span>' |
| 37 | + * // -> '<span>1</span>' |
40 | 38 | * |
41 | 39 | * ``` |
42 | 40 | * @category Lifecycle hooks |
|
54 | 52 | * abort. |
55 | 53 | * @param config The ManagerConfig to set. |
56 | 54 | * @returns A reference to the Manager, or `undefined` if called from outside an |
57 | | - * active ManagerProvider. |
| 55 | + * active Provider. |
58 | 56 | * @example |
59 | 57 | * This example creates a Manager object and sets its configuration. |
60 | 58 | * |
|
97 | 95 | * @param withDefaults An optional boolean indicating whether to return the full |
98 | 96 | * configuration, including defaults. |
99 | 97 | * @returns The configuration as a ManagerConfig or ManagerConfigWithDefaults, |
100 | | - * or `undefined` if called from outside an active ManagerProvider. |
| 98 | + * or `undefined` if called from outside an active Provider. |
101 | 99 | * @example |
102 | 100 | * This example creates a Manager object and gets its default configuration. |
103 | 101 | * No additional configuration has been provided, so when the `withDefaults` |
|
130 | 128 | * @param categoryId The Id of the category to create or update. |
131 | 129 | * @param config The TaskRunConfig to set. |
132 | 130 | * @returns A reference to the Manager, or `undefined` if called from outside an |
133 | | - * active ManagerProvider. |
| 131 | + * active Provider. |
134 | 132 | * @example |
135 | 133 | * This example creates a category called `network` with a specific maximum |
136 | 134 | * duration. |
|
180 | 178 | * configuration, including defaults. |
181 | 179 | * @returns The configuration as a TaskRunConfig (or `undefined` if the category |
182 | 180 | * Id does not exist) or TaskRunConfigWithDefaults, or `undefined` if called |
183 | | - * from outside an active ManagerProvider. |
| 181 | + * from outside an active Provider. |
184 | 182 | * @example |
185 | 183 | * This example creates a category called `network` with a specific maximum |
186 | 184 | * duration. Its configuration can be accessed with or without the defaults |
|
219 | 217 | * The useGetCategoryIds hook is the equivalent of the Manager's getCategoryIds |
220 | 218 | * method, and returns an array containing all registered category Ids. |
221 | 219 | * @returns An array of category Ids, or `undefined` if called from outside an |
222 | | - * active ManagerProvider. |
| 220 | + * active Provider. |
223 | 221 | * @example |
224 | 222 | * This example creates categories called `network` and `file`. Their Ids are |
225 | 223 | * retrieved. |
|
243 | 241 | * method, and deletes a category configuration. |
244 | 242 | * @param categoryId The Id of the category to delete. |
245 | 243 | * @returns A reference to the Manager, or `undefined` if called from outside an |
246 | | - * active ManagerProvider. |
| 244 | + * active Provider. |
247 | 245 | * @example |
248 | 246 | * This example creates a category called `network` which is then deleted. |
249 | 247 | * |
|
282 | 280 | * @param categoryId The optional Id of a category to associate the task with. |
283 | 281 | * @param config An optional TaskRunConfig to set for all runs of this Task. |
284 | 282 | * @returns A reference to the Manager, or `undefined` if called from outside an |
285 | | - * active ManagerProvider. |
| 283 | + * active Provider. |
286 | 284 | * @example |
287 | 285 | * This example registers a task called `ping` that fetches content from a |
288 | 286 | * website. |
|
351 | 349 | * configuration, including defaults. |
352 | 350 | * @returns The configuration as a TaskRunConfig (or `undefined` if the Task Id |
353 | 351 | * does not exist) or TaskRunConfigWithDefaults, or `undefined` if called from |
354 | | - * outside an active ManagerProvider. |
| 352 | + * outside an active Provider. |
355 | 353 | * @example |
356 | 354 | * This example creates a category, and registers a task for which the |
357 | 355 | * configuration is returned. |
|
393 | 391 | * The useGetTaskIds hook is the equivalent of the Manager's getTaskIds method, |
394 | 392 | * and returns an array containing all registered task Ids. |
395 | 393 | * @returns An array of task Ids, or `undefined` if called from outside an |
396 | | - * active ManagerProvider. |
| 394 | + * active Provider. |
397 | 395 | * @example |
398 | 396 | * This example creates tasks called `ping` and `pong`. Their Ids are |
399 | 397 | * retrieved. |
|
417 | 415 | * deletes a task registration. |
418 | 416 | * @param taskId The Id of the task to delete. |
419 | 417 | * @returns A reference to the Manager, or `undefined` if called from outside an |
420 | | - * active ManagerProvider. |
| 418 | + * active Provider. |
421 | 419 | * @example |
422 | 420 | * This example creates a task called `ping` which is then deleted. |
423 | 421 | * |
|
465 | 463 | * run. |
466 | 464 | * @param config An optional TaskRunConfig to set for this run. |
467 | 465 | * @returns A new unique Id of the scheduled task run, or `undefined` if called |
468 | | - * from outside an active ManagerProvider. |
| 466 | + * from outside an active Provider. |
469 | 467 | * @example |
470 | 468 | * This example registers a task that is then scheduled to run. |
471 | 469 | * |
|
538 | 536 | * configuration including defaults. |
539 | 537 | * @returns The configuration as a TaskRunConfig (or `undefined` if the task run |
540 | 538 | * Id does not exist) or TaskRunConfigWithDefaults, or `undefined` if called |
541 | | - * from outside an active ManagerProvider. |
| 539 | + * from outside an active Provider. |
542 | 540 | * @example |
543 | 541 | * This example registers a task that has a category and that is then |
544 | 542 | * scheduled to run. The configuration is then returned. |
|
586 | 584 | * If the task run Id does not exist, this method will return `undefined`. |
587 | 585 | * @param taskRunId The Id of the task run to get information for. |
588 | 586 | * @returns The TaskRunInfo for the task run, or `undefined` if the task run Id |
589 | | - * does not exist, or `undefined` if called from outside an active |
590 | | - * ManagerProvider. |
| 587 | + * does not exist, or `undefined` if called from outside an active Provider. |
591 | 588 | * @example |
592 | 589 | * This example registers a task that is then scheduled to run. The info is |
593 | 590 | * then returned. |
|
630 | 627 | * and deletes a scheduled task run or aborts a running one. |
631 | 628 | * @param taskRunId The Id of the task run to delete or abort. |
632 | 629 | * @returns A reference to the Manager, or `undefined` if called from outside an |
633 | | - * active ManagerProvider. |
| 630 | + * active Provider. |
634 | 631 | * @example |
635 | 632 | * This example registers a task that is then scheduled to run. The task run |
636 | 633 | * is then deleted. |
|
662 | 659 | * running, it will disappear from this list and appear on the list of running |
663 | 660 | * task runs, accessible instead with the getRunningTaskRunIds method. |
664 | 661 | * @returns An array of task run Ids, or `undefined` if called from outside an |
665 | | - * active ManagerProvider. |
| 662 | + * active Provider. |
666 | 663 | * @example |
667 | 664 | * This example registers a task that is then scheduled to run twice. |
668 | 665 | * |
|
696 | 693 | * getScheduledTaskRunIds method. Once it starts running, it will instead move |
697 | 694 | * to appear on this list. |
698 | 695 | * @returns An array of task run Ids, or `undefined` if called from outside an |
699 | | - * active ManagerProvider. |
| 696 | + * active Provider. |
700 | 697 | * @example |
701 | 698 | * This example registers a task that is then scheduled to run. Once it runs, |
702 | 699 | * its Id appears on the list of running tasks. |
|
746 | 743 | * expected that you will only start it once at the beginning of your app's |
747 | 744 | * lifecycle, and then stop it when it closes and you are cleaning up. |
748 | 745 | * @returns A reference to the Manager, or `undefined` if called from outside an |
749 | | - * active ManagerProvider. |
| 746 | + * active Provider. |
750 | 747 | * @example |
751 | 748 | * This example registers a task that is then scheduled to run. The Manager is |
752 | 749 | * then started, and one `tickInterval` later, the task run starts. |
|
789 | 786 | * @param force Whether to stop the Manager immediately instead of waiting for |
790 | 787 | * all scheduled task runs to complete. |
791 | 788 | * @returns A reference to the Manager, or `undefined` if called from outside an |
792 | | - * active ManagerProvider. |
| 789 | + * active Provider. |
793 | 790 | * @example |
794 | 791 | * This example registers a task that is then scheduled to run twice. The |
795 | 792 | * Manager is started, and one `tickInterval` later, stopped again. With the |
|
837 | 834 | * This returns a simple numeric value that indicates whether the Manager is |
838 | 835 | * stopped (0), running (1), or stopping (2). |
839 | 836 | * @returns The status of the Manager, or `undefined` if called from outside an |
840 | | - * active ManagerProvider. |
| 837 | + * active Provider. |
841 | 838 | * @category Lifecycle hooks |
842 | 839 | * @since v1.1.0 |
843 | 840 | */ |
|
848 | 845 | * |
849 | 846 | * It is simply an alias for the JavaScript `Date.now` function. |
850 | 847 | * @returns The current timestamp in milliseconds, or `undefined` if called from |
851 | | - * outside an active ManagerProvider. |
| 848 | + * outside an active Provider. |
852 | 849 | * @example |
853 | 850 | * This example gets the current time in milliseconds from the Manager. |
854 | 851 | * |
|
864 | 861 | */ |
865 | 862 | /// useGetNow |
866 | 863 | /** |
867 | | - * ManagerProviderProps props are used with the Manager component, so that a |
868 | | - * TinyTick Manager can be passed into the context of an application and used |
869 | | - * throughout. |
| 864 | + * ProviderProps props are used with the Manager component, so that a TinyTick |
| 865 | + * Manager can be passed into the context of an application and used throughout. |
870 | 866 | * @category Props |
871 | 867 | * @since v1.1.0 |
872 | 868 | */ |
873 | | -/// ManagerProviderProps |
| 869 | +/// ProviderProps |
874 | 870 | { |
875 | 871 | /** |
876 | 872 | * Whether the Manager should be started on first render, defaulting to |
877 | 873 | * `true`. |
878 | 874 | * @category Prop |
879 | 875 | * @since v1.1.0 |
880 | 876 | */ |
881 | | - /// ManagerProviderProps.started |
| 877 | + /// ProviderProps.started |
882 | 878 | /** |
883 | 879 | * Whether the Manager should be force-stopped when the context is unmounted, |
884 | 880 | * defaulting to `true`. |
885 | 881 | * @category Prop |
886 | 882 | * @since v1.1.0 |
887 | 883 | */ |
888 | | - /// ManagerProviderProps.forceStop |
| 884 | + /// ProviderProps.forceStop |
889 | 885 | } |
890 | 886 | /** |
891 | | - * The ManagerProvider component is used to wrap part of an application in a |
892 | | - * context that provides a Manager to be used by hooks and components within. |
| 887 | + * The Provider component is used to wrap part of an application in a context |
| 888 | + * that provides a Manager to be used by hooks and components within. |
893 | 889 | * @param props The props for this component. |
894 | 890 | * @returns A rendering of the child components. |
895 | 891 | * @category Context components |
896 | 892 | * @since v1.1.0 |
897 | 893 | */ |
898 | | -/// ManagerProvider |
| 894 | +/// Provider |
0 commit comments