Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

_ is not a function error #7

Closed
josephmawa opened this issue Nov 30, 2024 · 1 comment
Closed

_ is not a function error #7

josephmawa opened this issue Nov 30, 2024 · 1 comment

Comments

@josephmawa
Copy link
Owner

This error is thrown because, _ is being used as parameter value for the action handlers. The _, which is a parameter, is invoked instead of globalThis._. Rename the parameter to _deleteSavedColorAction.

deleteSavedColorAction.connect("activate", (_, colorId) => {
  const confirmDeleteOne = new ConfirmDeleteOne();

  confirmDeleteOne.connect("response", (actionDialog, response) => {
    if (response === "cancel") return;

    const id = colorId?.unpack();
    const [idx, item] = this.getItem(id);

    if (idx === null) {
      throw new Error(`id: ${id} is non-existent`);
    }

    this._saved_colors_selection_model.model.remove(idx);
    this.displayToast(_("Deleted saved color successfully"));
  });

  confirmDeleteOne.present(this);
});
@josephmawa
Copy link
Owner Author

Fixed by #6

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant