• JMap.Application.Message.confirmMessage

    Prompts a confirmation dialog message on the screen.

    Parameters

    Returns void

    Deprecated

    Use JMap.Message.confirmMessage instead.

    The onSuccess callback is called when the user clicked "confirm" button.

    If it's an input confirm message, the onSuccess will get the input, else an empty string.

    The optional onCancel callback is called when the cancel button is clicked.

    Message content has three intended forms:

    • Plain text: message: "Delete project foo?"
    • Sanitized HTML string: message: { kind: "html", value: "Delete <b>foo</b>?", policy: "dialog" } This is especially useful with translated rich strings, for example: message: { kind: "html", value: JMap.Language.translate("project.delete.message", { projectName: "<b>My project</b>" }), policy: "dialog" }
    • JSX / ReactNode: message: { kind: "node", value: <>Delete <strong>{project.name}</strong>?</> }

    Plain text is the default. Prefer JSX / node content when formatting is needed; use HTML only for legacy rich string flows that still require sanitization at render time.

    Example

    JMap.Application.Message.confirmMessage({
    message: "Are you sure to do a given action ?",
    onSuccess: () => console.log(`The user is sure`),
    onCancel: () => console.info("The user is not sure")
    })

    JMap.Application.Message.confirmMessage({
    message: "City name :",
    isInputMessage: true,
    onSuccess: cityName => console.log(`City name input = ${cityName}`),
    onCancel: () => console.info("Input has been canceled")
    })