All Projects → binarybaba → prophetjs

binarybaba / prophetjs

Licence: MIT license
Vanilla JS library to display toast messages.

Programming Languages

typescript
32286 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to prophetjs

Ajmessage
Simple popup message
Stars: ✭ 30 (-3.23%)
Mutual labels:  popup, message, notification
flasher
A powerful and flexible flash notifications system for PHP
Stars: ✭ 46 (+48.39%)
Mutual labels:  toastr, notification
yii2-toastr
Yii2 - Javascript Toast Notifications
Stars: ✭ 25 (-19.35%)
Mutual labels:  toastr, notification
Swiftentrykit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.
Stars: ✭ 5,706 (+18306.45%)
Mutual labels:  popup, notification
Multiplatform-Bus
Kotlin event-bus compatible with Android & native iOS
Stars: ✭ 43 (+38.71%)
Mutual labels:  message, notification
Nativescript Feedback
📢 Non-blocking textual feedback for your NativeScript app
Stars: ✭ 127 (+309.68%)
Mutual labels:  message, notification
SimpleToast
SimpleToast is a simple, lightweight, flexible and easy to use library to show toasts / popup notifications inside iOS or MacOS applications in SwiftUI. Because of the flexibility to show any content it is also possible to use the library for showing simple modals.
Stars: ✭ 131 (+322.58%)
Mutual labels:  popup, notification
Fftoast
A very powerful iOS message notifications and AlertView extensions. It can be easily realized from the top of the screen, the bottom of the screen and the middle of the screen pops up a notification. You can easily customize the pop-up View.
Stars: ✭ 649 (+1993.55%)
Mutual labels:  message, notification
Customalertviewdialogue
Custom AlertView Dialogue is the world's most advanced alert view library. Custom AlertView Dialogue includes simple message popups, confirmation alerts, selector popups, action sheet bottom menus, and input/feedback contact forms.
Stars: ✭ 100 (+222.58%)
Mutual labels:  popup, message
vercel-toast
💬 Framework-agnostic vercel design's toast component (≈1KB Gzipped)
Stars: ✭ 67 (+116.13%)
Mutual labels:  popup, message
Toast
To use it in PCL or .NetStandard projects write this line of code : CrossToastPopUp.Current.ShowToastMessage("Message");
Stars: ✭ 51 (+64.52%)
Mutual labels:  message, notification
Jquery Confirm
A multipurpose plugin for alert, confirm & dialog, with extended features.
Stars: ✭ 1,776 (+5629.03%)
Mutual labels:  popup, callback
Vue Toasted
🖖 Responsive Touch Compatible Toast plugin for VueJS 2+
Stars: ✭ 2,091 (+6645.16%)
Mutual labels:  toastr, notification
Anylayer
Android稳定高效的浮层创建管理框架
Stars: ✭ 745 (+2303.23%)
Mutual labels:  popup, notification
Vueup
Simple, lightweight and super fast global notification popup for Vue.js
Stars: ✭ 104 (+235.48%)
Mutual labels:  popup, notification
SHPopup
A lightweight library for popup view
Stars: ✭ 36 (+16.13%)
Mutual labels:  popup, message
wxpusher-sdk-python
微信消息实时推送服务[WxPusher]的Python版本sdk,可以通过API实时给个人微信推送消息。wechat pusher.
Stars: ✭ 156 (+403.23%)
Mutual labels:  notification
laravel-notification-settings
🔒 A Laravel package that allows you to check the notification settings before send them.
Stars: ✭ 28 (-9.68%)
Mutual labels:  notification
PushNotifications
Push Notification using Embarcadero Rad Studio Tokyo 10.2.3 on Android and Apple Devices written in C++ and Delphi
Stars: ✭ 12 (-61.29%)
Mutual labels:  notification
tasker-config
My very own tasker configuration
Stars: ✭ 28 (-9.68%)
Mutual labels:  message

prophetjs

NPM NPM

A very lean awesome dependency free javascript library to display toast messages on web pages. This project adheres to Semantic Versioning. Sometimes I do screw up though. For an AngularJS directive, checkout ngProphet. Prophet currently supports:

  • Chrome v26+
  • Firefox v20+
  • IE v10+ (sorry)
  • Safari v5+

Version 1.0.0

default

Table of Contents

Installation

Get the files:

Choose any of the ways to get prophet:

  • clone from github git clone https://github.com/binarybaba/prophetjs.git
  • Install from npm npm install prophetjs --save
  • Install from bower bower install prophetjs --save

Find the files

You'll see the files in the dist folder:

dist
├── css
│   ├── prophet.css
│   └── prophet.min.css
└── js
    ├── prophet.js
    ├── prophet.js.map
    └── prophet-min.js

Wire it up

Include the css and js files in your webpage:

<link rel="stylesheet" href="dist/css/prophet.min.css">

<script src="dist/js/prophet-min.js"></script>

<ul class="prophet"></ul>

or

import Message from 'prophetjs'

API

Prophet exposes a Message API. All customizations and configurations are done through this API. To show a message, you will have to instantiate an instance of Message.

The toast message stays for a default duration of 4000 milliseconds or until the user clicks on it. After which, the toast message is removed from the DOM.

Simplest display

var toast = new Message('Harambe for president!').show();

Callback

You can also provide a callback to every toast message. The callback will be triggered after the toast message is removed or when the user clicks on it. The callback sends the autogenerated ID of the toast message (which can be overridden).

callback no-callback

var toast = new Message("Awesome! We'll contact you soon!", function(id){
    console.log('Message ID:', id);
    // some more code...
    });
    toast.show();
}

Options

You can also optionally include a set of options as a second argument (followed by the callback if any ) on every toast message. If the values are not implemented, the default values take up. (Prophet was written in TypeScript which enforces type checking for development. Hence, it implements an interface IMessageOptions. More on that here...) The following are the keys that options takes

  • id The id is autogenerated per toast message.

    • default: auto-generated
    • Type: number
  • type Prophet has 3 presets types: success, error and default. You can also set more presets. Click here to see how.

    error

    • default: "default"
    • Type: string
  • duration The time each toast message stays on the web page before disappearing. Takes value in miliseconds.

    • default: 4000
    • Type: number
  • class You can further customize the look of every toast message by providing extra CSS classes to override. Takes a single string of class names seperated by spaces.

    • default: ""
    • Type: string
Example
var ppap = new Message("Awesome! Pen Pineapple Apple Pen.", {
        id:i++, //i defined somewhere up above
        duration: 8000,
        type: 'success',
        class : 'blue-background white-text thin-border'
    }).show();

Custom Types

You can also add more types by providing the background-color, color and type for more uses. Please note, all the keys are mandatory.

Message.config.types({
    type: "tip",
    backgroundColor:"#fafafa",
    color:"#313131"
})

Now you can use the type while invoking a new Message:

var ppap = new Message("Awesome! Pen Pineapple Apple Pen.", { type: 'tip'}, function(id){
     console.log(id);
 })
 ppap.show();

stackUp

Contributing

Thanks for taking out time for actually reading this block. You're awesome! Prophetjs is written in TypeScript. I started writing this library as my venture into getting to know TypeScript better so if you're thinking of contributing, please do install TypeScript as your dev dependencies. I'll be further updating this section to include guides on how to get your way around the compiler and how you can install it per your IDE/editor (and maybe put this whole section in a new file)

License

Open source under the MIT License. All rights reserved.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].