Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/contextmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ export function setCurrentBlock(block: Block | null) {
*/
let menu_: Menu | null = null;

/**
* Gets Menu instance.
*
* @returns menu instance.
Comment on lines +62 to +64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that would be really helpful to include is context on the menu's lifecycle. Specifically:

  • When is it defined? (Relative to other functions called here)
  • When is null returned? What does that mean/what can the caller infer from receiving a null value?
  • Is it valid to save the returned value or could that cause problems (e.g. if the menu is later closed)?

These would be great to clarify in the documentation here for a more solid defined API contract for callers.

*/
export function getMenu(): Menu | null {
return menu_;
}

/**
* Construct the menu based on the list of options and show the menu.
*
Expand Down
Loading