Skip to content

Commit

Permalink
refactor: add configs comment about timing things
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Mar 26, 2024
1 parent c6223da commit 9fa6a6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export declare interface FastboardProps {
app?: FastboardApp | null;
theme?: Theme;
language?: Language;
/**
* Note: updating this option does not take effect when the element was mounted.
* Make sure to set this option in `UI.mount(div, { containerRef })`.
*/
containerRef?: (container: HTMLDivElement | null) => void;
config?: FastboardUIConfig;
}
Expand Down
6 changes: 5 additions & 1 deletion packages/fastboard-ui/src/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export interface ToolbarConfig {
placement?: "left" | "right";
/** @default ["clicker", "selector", "pencil", "text", "shapes", "eraser", "clear"] */
items?: ToolbarItem[];
/** @default false */
/**
* Note: updating this option does not take effect when the element was mounted.
* Make sure to set this option in `UI.mount(div, { configs: { toolbar: { collapsed: true } } })`.
* @default false
*/
collapsed?: boolean;
/** Control the last button which opens apps stock on toolbar. */
apps?: { enable?: boolean };
Expand Down
8 changes: 7 additions & 1 deletion packages/fastboard/test/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ createFastboard({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).app = app;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).ui = createUI(app, root);
let ui = (window as any).ui = createUI(app);

Check warning on line 25 in packages/fastboard/test/main.ts

View workflow job for this annotation

GitHub Actions / lint_and_build

'ui' is never reassigned. Use 'const' instead

ui.mount(root, {
config: {
toolbar: { collapsed: true }
}
});
});

resizable(root, {
Expand Down

0 comments on commit 9fa6a6c

Please sign in to comment.