• Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language
    JavaScript
  • Created about 9 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Screamer.js is a Vanilla Javascript plugin to provide simple yet fully customisable web notifications using Web Notifications API.

Screamer.JS

Build Status

Minion using Megaphone

Screamer.js is a Vanilla Javascript plugin to provide simple yet fully customisable web notifications using Web Notifications API.

Demo

screenshot of notifications

If you want to see how it works, take a look at the DEMO.

Installation

  1. Download the zip
  2. Paste the screamer.js at your js assets folder.
  3. If you want to use same images, get them on [https://github.com/willianjusten/screamer-js/tree/master/example] and paste to your img assets folder.

How to Use

CommonJS

var Screamer = require('screamer');
var notification = new Screamer(options);

AMD

define([ 'Screamer' ], function( Screamer ) {
  var notification = new Screamer(options);
});

To create the Notification you have to create a new instance of Screamer, set some options that you wish and use the notify method to start the notification. Take a look at this snippet:

// create an instance of Screamer with some options
var scream = new Screamer({
    'title': 'Success!',
    'body': 'Lorem ipsum dolor sit amet.',
    'icon': 'icon_success.png',
    'fade': 1000
});

// adding an eventListener to call the Notification
var button = document.querySelector('#fade');
button.addEventListener('click', function(){
    scream.notify();
});

You can attach this to different events, like onload, ready or anything else that allows to call the notify method.

Options

  • title (string) - notification title. (REQUIRED)
  • body (string) - notification message.
  • icon (string) - path to the notification icon.
  • tag (string) - unique identifier to stop duplicate notifications.
  • lang (string) - language of the notification. (default: en).
  • timeout (integer) - time in miliseconds to fade the notification.
  • before (function) - A callback function called before show the notification.
  • after (function) - A callback function called after show the notification.

Static Methods

  • Screamer.verifySupport() - Function to test for Web Notifications API browser support.
  • Screamer.checkPermission() - Verify if permission exists, if not, request a permission and verify if granted.

Testing

First of all, install the NodeJS and deppendencies.

npm install

Later, you can run all tests running:

npm test

This should be open a Firefox instance and do a single run of tests.

Run Demo locally

Because the Web Notification require some permissions, you have to run this on a single server. An easy way to run this is:

python -m SimpleHTTPServer

Pay attention if your port is not in use.

Browser Support

This library relies on Web Notifications API. And this API is supported in the following browsers.

Chrome Firefox Opera Safari IE
31+ ✔ 38+ ✔ 32+ ✔ 8+ ✔ Nope ✘

Thanks

This project would be nothing without this guys:

License

This plugin is free and open source software, distributed under the The MIT License. So feel free to use this to create notifications for your site without linking back to me or using a disclaimer.

If you’d like to give me credit somewhere on your blog or tweet a shout out to @willian_justen, that would be pretty sweet.

More Repositories

1

awesome-audio-visualization

A curated list about Audio Visualization.
Shell
4,589
star
2

awesome-svg

A curated list of SVG.
Shell
4,521
star
3

will-jekyll-template

A simple Jekyll theme.
HTML
379
star
4

cards-jekyll-template

A simple Jekyll Template Card Based.
HTML
318
star
5

nba-remix

A simple app to show NBA games and scores/details.
TypeScript
209
star
6

js-tdd-course

Files to my course JS com TDD na prática
JavaScript
192
star
7

es6-curso

Arquivos das aulas do curso de ES6
HTML
185
star
8

gatsby-course

A blog made with gatsby to my gatsby course
JavaScript
176
star
9

Fast

A simple boilerplate to create projects with Jade, Stylus, Gulp and Browserify
HTML
123
star
10

github-course

Um repositório simples utilizado no curso de Git.
93
star
11

dumb-codepen

A simple live editor with very few lines of code.
JavaScript
89
star
12

labs

Some experiments created by me to explain some concept or just for fun =)
HTML
87
star
13

curso-de-svg

Contents from my course about SVG
HTML
81
star
14

greensock-course

Files to my course about Greensock on Udemy
HTML
75
star
15

spotify-wrapper

A javascript wrapper library to work with Spotify API.
JavaScript
65
star
16

dotfiles

My Mac OS dotfiles
Shell
62
star
17

audio-experiments

My experiments using Web Audio API.
JavaScript
49
star
18

my-trips

TypeScript
46
star
19

discord-tailwind

Just a Discord clone made with TailwindCSS
TypeScript
44
star
20

script-dev

A simple script for basic installation of web development programs for Linux. (Debian Based)
Shell
43
star
21

japanese-words

Discover new japanese words each time you see the page.
TypeScript
42
star
22

on-leave-intent

A script to detect if the user is leaving the page and calls a function.
JavaScript
41
star
23

eve

A simple bot to work with the new Facebook Messenger API using Wit.ai.
JavaScript
39
star
24

minimal-blog

Um blog simples ensinando como utilizar o Jekyll para o curso.
CSS
35
star
25

btc-converter

A CLI to convert Bitcoin to any currency provided.
JavaScript
35
star
26

resume

My resume in markdown.
34
star
27

spotify-wrapper-player

An example using the spotify-wrapper lib to my JS TDD course.
JavaScript
34
star
28

photo-portfolio

A template redesigned by me to teach git commands in my new course.
CSS
32
star
29

webpack-example

Just an example of webpack configuration.
JavaScript
28
star
30

Fast-nunjucks

A simple boilerplate to create static sites using nunjucks templates, stylus and gulp to automate.
CSS
28
star
31

nba-nextjs

See NBA game results and standings powered by Next.js
TypeScript
26
star
32

willianjusten

My beautiful Readme
26
star
33

photos-portfolio

TypeScript
25
star
34

learn-japanese

Learn hiragana and katakana in an easy way.
TypeScript
25
star
35

kata-playground-ts

A simple playground to create and test your Katas in Typescript.
JavaScript
23
star
36

nextjs10-image

TypeScript
22
star
37

sublime-preferences

My list of plugins and settings for Sublime Text
21
star
38

user-idle-tracker

A library to check the status of the user and to run a callback when its considered Idle.
JavaScript
20
star
39

svg-animation-css

A simple SVG experiment using css animations.
HTML
19
star
40

use-konami-code

A simple custom react hook to verify a sequence of typed keys from the user.
JavaScript
16
star
41

nextjs-pratica

TypeScript
15
star
42

volta-mozao

Just a joke that I decided to make to my girlfriend.
JavaScript
15
star
43

github-stars-feed-rss

A simple action to populate my profile on GitHub Stars site with my latest blog posts and youtube videos.
JavaScript
14
star
44

boilerplate-cra-demo

A simple demo to show the boilerplate-cra from React Avançado
TypeScript
10
star
45

braziljs-16

My slides to BrazilJS 16.
CSS
10
star
46

react-full-header

A Full Header component create with React.
JavaScript
10
star
47

svg-gulp-optimizer

Some tests to optimize svg using Gulp, svgo, gulp-svgfallback and gulp-svgstore.
JavaScript
9
star
48

js-tdd-slides

Slides to my course JS com TDD na Prática.
CSS
9
star
49

crawler-huge

🚧 work in progress - A simple crawler that creates a json with urls and take screenshots.
JavaScript
9
star
50

svg-grunt-optimizer

Some tests to optimize svg using svgo, svg2png and grunt-svgstore.
HTML
9
star
51

boilerplate-graphql-demo

A simple demo to show the boilerplate-graphql from React Avançado
TypeScript
9
star
52

DinoChromeUnity

A clone for the famous Dino Game from Chrome when offline. My second game using Unity.
ShaderLab
7
star
53

bootstrap-boilerplate

A simple boilerplate to create projects with jade, bootstrap-sass and gulp
CSS
6
star
54

front-in-bh-16

My slides to Front in BH 16.
CSS
5
star
55

python-workshop

Files from my workshop about python
Python
5
star
56

willianjusten.com.br

Um blog sobre desenvolvimento web com foco em frontend. - https://willianjusten.com.br
JavaScript
4
star
57

gdg-bh-2015

Meus slides para o evento GDG BH 2015
HTML
4
star
58

devconf-18

My slides and examples to devconf
CSS
4
star
59

trab-sas

A simple project to control nmap and iptables over web interface.
JavaScript
4
star
60

python-vale-18

My slides to python-vale-18
CSS
4
star
61

front-in-rio-16

Repositório com o código exemplo feito para o Front in Rio 2016 Html Edition
HTML
3
star
62

apod

A simple website to show Astronomy Picture of the Day using NASA API.
HTML
3
star
63

python-class-1

Some slides of my talk about python.
HTML
3
star
64

meetup-css-sp

My slides to Meetup CSS - SP.
CSS
3
star
65

trabalho-so2

Multiplicação de Matrizes utilizando Forks, Threads e MPI
C
3
star
66

imasters-2015

My slides to Imasters Developers Week RJ - 2015.
HTML
3
star
67

semcomp-2015

My slides to SEMCOMP 2015.
HTML
3
star
68

photo-examples

2
star
69

learnyounode-answers

Answers to the learnyounode from http://nodeschool.io/
JavaScript
2
star
70

frontend-carioca-2015

My slides to Frontend Carioca - 2015.
HTML
2
star
71

notetaker

An app to annotate info about some user on Github.
JavaScript
2
star
72

strapi-nested-bug-graphql

JavaScript
2
star
73

EloquentJS-Exercises

My exercises and projects from the book.
JavaScript
2
star
74

albumcolors

Over 150 covers creating a beautiful color palete.
HTML
2
star
75

frontinsampa-16

My slides to Front in Sampa 16.
CSS
1
star
76

fast-email-boilerplate

Kickstarter the development of email templates
CSS
1
star
77

python-para-zumbis

My exercises for Python para Zumbis.
Python
1
star
78

starwars-names

Get random Star Wars names.
JavaScript
1
star
79

FlappBirdUnity

Just a Flappy Bird clone as my first attempt to learn unity
C#
1
star
80

og-image-blog

TypeScript
1
star