[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Dec 13, 2019. It is now read-only.
/ notification Public archive

Native Alert Messages for Cordova with web fallback - metoer

Notifications You must be signed in to change notification settings

flowkey/notification

Repository files navigation

iOS Native Style Alerts

Native alerts and confirm boxes for cordova and a carefully styled browser version (blaze).

Import

import { notification } from 'flowkey:notification';

notification.alert

notification.alert({
    message:
        "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.",
    title: "This is a test Message",
    buttonLabel: "Nice",
    callback: function() {},
});

// if no callback is provided you can await the user's button click
await notification.alert({
    message:
        "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.",
    title: "This is a test Message",
    buttonLabel: "Nice",
});

notification.confirm

notification.confirm({
    message:
        "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.",
    title: "This is a test Message",
    callback: function(index) {}, // index(String) conforms with the buttonLabels index counting from 1 - same for ios
    buttonLabels: ["Ok", "Not now"],
});

// if no callback is provided you can await the user's choice
const buttonIndex = await notification.confirm({
    message:
        "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.",
    title: "This is a test Message",
    buttonLabels: ["Ok", "Not now"],
});

Notice

  • Safari To style correctly in safari any of the parents in the dom should have 'safari' as a class, no browser detection implemented inside this package

About

Native Alert Messages for Cordova with web fallback - metoer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published