Skip to content

Commit 7b0ff87

Browse files
committed
Merge branch 'gh-pages' of https://github.com/Nickersoft/push.js into gh-pages
2 parents 6e4905c + 6712361 commit 7b0ff87

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

index.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ <h3>
4040

4141
<p>For more information regarding the Push NPM package, <a href="https://www.npmjs.com/package/push.js">see here</a>.</p>
4242

43-
<h4>
44-
<a id="see-it-in-action" class="anchor" href="#see-it-in-action" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>See It In Action</h4>
45-
46-
<p>Before you go out and try Push for yourself, you probably want to confirm it actually works in your browser, right?</p>
47-
48-
<p>Lucky for you a demo is available <a href="http://nickersoft.github.io/push.js/demo.html">here</a>.</p>
49-
5043
<h4>
5144
<a id="creating-notifications" class="anchor" href="#creating-notifications" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Creating Notifications</h4>
5245

@@ -123,8 +116,22 @@ <h4>
123116
<strong>tag</strong>: Unique tag used to identify the notification. Can be used to later close the notification manually.</li>
124117
<li>
125118
<strong>timeout</strong>: Time in milliseconds until notification closes automatically.</li>
119+
<li>
120+
<strong>vibrate</strong>: An array of durations for a mobile device receiving the notification to vibrate. For example, [200, 100] would vibrate first for 200 milliseconds, pause, then continue for 100 milliseconds. For more information, see below.</li>
126121
</ul>
127122

123+
<h3>
124+
<a id="mobile-support" class="anchor" href="#mobile-support" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Mobile Support</h3>
125+
126+
<p>Push can be used on Android Chrome (apparently Safari on iOS does not have notification support), but the website in which it is running on <strong><em>must</em></strong> use have a valid SSL certificate (HTTPS only!!) otherwise it will not work. This is due to Google's <a href="https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/BygptYClroM">decision to drop the Notification constructor</a> from mobile Chrome. Sucks but hey, that's life, am I right?</p>
127+
128+
<h3>
129+
<a id="see-it-in-action" class="anchor" href="#see-it-in-action" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>See It In Action</h3>
130+
131+
<p>Before you go out and try Push for yourself, you probably want to confirm it actually works in your browser, right?</p>
132+
133+
<p>Lucky for you a demo is available <a href="http://nickersoft.github.io/push.js/demo.html">here</a>.</p>
134+
128135
<h3>
129136
<a id="credits" class="anchor" href="#credits" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Credits</h3>
130137

params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Push.js",
33
"tagline": "A compact, cross-browser solution for using the JavaScript Notifications API",
4-
"body": "# Push [![Build Status](https://travis-ci.org/Nickersoft/push.js.svg?branch=master)](https://travis-ci.org/Nickersoft/push.js)\r\n\r\n### What is Push? ###\r\n\r\nPush is the fastest way to get up and running with Javascript desktop notifications. A fairly new addition to the official specification, the Notification API allows modern browsers such as Chrome, Safari, Firefox, and IE 9+ to push notifications to a user's desktop. Push acts as a cross-browser solution to this API, falling back to use older implementations if the user's browser does not support the new API.\r\n\r\nYou can quickly install Push via [npm](http://npmjs.com):\r\n\r\n```\r\nnpm install push.js --save\r\n```\r\n\r\nOr, if you want something a little more lightweight, you can give [Bower](http://bower.io) a try:\r\n\r\n```\r\nbower install push.js --save\r\n```\r\n\r\nFor more information regarding the Push NPM package, [see here](https://www.npmjs.com/package/push.js).\r\n\r\n#### See It In Action ####\r\n\r\nBefore you go out and try Push for yourself, you probably want to confirm it actually works in your browser, right?\r\n\r\nLucky for you a demo is available [here](http://nickersoft.github.io/push.js/demo.html).\r\n\r\n#### Creating Notifications ####\r\nSo just how easy is it to create a notification using Push? We can do it in just one line, actually:\r\n\r\n```javascript\r\nPush.create('Hello World!')\r\n```\r\n\r\nNo constructors, just a universal API you can access from anywhere. Push is even compatible with AMD as well:\r\n\r\n```javascript\r\ndefine(['pushjs'], function (Push) {\r\n Push.create('Hello World!');\r\n});\r\n```\r\n\r\nIf the browser does not have permission to send push notifications, Push will automatically request permission as soon as create() is called. Simple as that.\r\n\r\n#### Closing Notifications ####\r\nWhen it comes to closing notifications, you have a few options. You can either set a timeout (see \"Options\"), call Push's close() method, or pass around the notification's promise object and then call close() directly. Push's close() method will only work with newer browsers, taking in a notification's unique tag name and closing the first notification it finds with that tag:\r\n\r\n```javascript\r\nPush.create('Hello World!', {\r\n tag: 'foo'\r\n});\r\n\r\n// Somewhere later in your code...\r\n\r\nPush.close('foo');\r\n```\r\n\r\nAlternatively, you can assign the notification promise returned by Push to a variable and close it directly using the promise's then() method:\r\n\r\n```javascript\r\nvar promise = Push.create('Hello World!');\r\n\r\n// Somewhere later in your code...\r\n\r\npromise.then(function(notification) {\r\n notification.close();\r\n});\r\n```\r\n\r\nWhen it comes to clearing all open notifications, that's just as easy as well:\r\n\r\n```javascript\r\nPush.clear();\r\n```\r\n\r\n### Options ###\r\n\r\nThe only required argument in a Push call is a title. However, that doesn't mean you can't add a little something extra. You can pass in options to Push as well, like so:\r\n\r\n```javascript\r\nPush.create('Hello World!', {\r\n body: 'This is some body content!',\r\n icon: {\r\n x16: 'images/icon-x16.png',\r\n x32: 'images/icon-x32.png'\r\n },\r\n timeout: 5000\r\n});\r\n```\r\n\r\n#### Available Options ####\r\n\r\n* __body__: The body text of the notification.\r\n* __icon__: Can be either the URL to an icon image or an array containing 16x16 and 32x32 pixel icon images (see above).\r\n* __onClick__: Callback to execute when the notification is clicked.\r\n* __onClose__: Callback to execute when the notification is closed (obsolete).\r\n* __onError__: Callback to execute when if the notification throws an error.\r\n* __onShow__: Callback to execute when the notification is shown (obsolete).\r\n* __tag__: Unique tag used to identify the notification. Can be used to later close the notification manually.\r\n* __timeout__: Time in milliseconds until notification closes automatically.\r\n\r\n### Credits ###\r\nPush is based off work the following work:\r\n\r\n1. [HTML5-Desktop-Notifications](https://github.com/ttsvetko/HTML5-Desktop-Notifications) by [Tsvetan Tsvetkov](https://github.com/ttsvetko)\r\n2. [notify.js](https://github.com/alexgibson/notify.js) by [Alex Gibson](https://github.com/alexgibson)\r\n",
4+
"body": "# Push [![Build Status](https://travis-ci.org/Nickersoft/push.js.svg?branch=master)](https://travis-ci.org/Nickersoft/push.js)\r\n\r\n### What is Push? ###\r\n\r\nPush is the fastest way to get up and running with Javascript desktop notifications. A fairly new addition to the official specification, the Notification API allows modern browsers such as Chrome, Safari, Firefox, and IE 9+ to push notifications to a user's desktop. Push acts as a cross-browser solution to this API, falling back to use older implementations if the user's browser does not support the new API.\r\n\r\nYou can quickly install Push via [npm](http://npmjs.com):\r\n\r\n```\r\nnpm install push.js --save\r\n```\r\n\r\nOr, if you want something a little more lightweight, you can give [Bower](http://bower.io) a try:\r\n\r\n```\r\nbower install push.js --save\r\n```\r\n\r\nFor more information regarding the Push NPM package, [see here](https://www.npmjs.com/package/push.js).\r\n\r\n#### Creating Notifications ####\r\nSo just how easy is it to create a notification using Push? We can do it in just one line, actually:\r\n\r\n```javascript\r\nPush.create('Hello World!')\r\n```\r\n\r\nNo constructors, just a universal API you can access from anywhere. Push is even compatible with AMD as well:\r\n\r\n```javascript\r\ndefine(['pushjs'], function (Push) {\r\n Push.create('Hello World!');\r\n});\r\n```\r\n\r\nIf the browser does not have permission to send push notifications, Push will automatically request permission as soon as create() is called. Simple as that.\r\n\r\n#### Closing Notifications ####\r\nWhen it comes to closing notifications, you have a few options. You can either set a timeout (see \"Options\"), call Push's close() method, or pass around the notification's promise object and then call close() directly. Push's close() method will only work with newer browsers, taking in a notification's unique tag name and closing the first notification it finds with that tag:\r\n\r\n```javascript\r\nPush.create('Hello World!', {\r\n tag: 'foo'\r\n});\r\n\r\n// Somewhere later in your code...\r\n\r\nPush.close('foo');\r\n```\r\n\r\nAlternatively, you can assign the notification promise returned by Push to a variable and close it directly using the promise's then() method:\r\n\r\n```javascript\r\nvar promise = Push.create('Hello World!');\r\n\r\n// Somewhere later in your code...\r\n\r\npromise.then(function(notification) {\r\n notification.close();\r\n});\r\n```\r\n\r\nWhen it comes to clearing all open notifications, that's just as easy as well:\r\n\r\n```javascript\r\nPush.clear();\r\n```\r\n\r\n### Options ###\r\n\r\nThe only required argument in a Push call is a title. However, that doesn't mean you can't add a little something extra. You can pass in options to Push as well, like so:\r\n\r\n```javascript\r\nPush.create('Hello World!', {\r\n body: 'This is some body content!',\r\n icon: {\r\n x16: 'images/icon-x16.png',\r\n x32: 'images/icon-x32.png'\r\n },\r\n timeout: 5000\r\n});\r\n```\r\n\r\n#### Available Options ####\r\n\r\n* __body__: The body text of the notification.\r\n* __icon__: Can be either the URL to an icon image or an array containing 16x16 and 32x32 pixel icon images (see above).\r\n* __onClick__: Callback to execute when the notification is clicked.\r\n* __onClose__: Callback to execute when the notification is closed (obsolete).\r\n* __onError__: Callback to execute when if the notification throws an error.\r\n* __onShow__: Callback to execute when the notification is shown (obsolete).\r\n* __tag__: Unique tag used to identify the notification. Can be used to later close the notification manually.\r\n* __timeout__: Time in milliseconds until notification closes automatically.\r\n* __vibrate__: An array of durations for a mobile device receiving the notification to vibrate. For example, [200, 100] would vibrate first for 200 milliseconds, pause, then continue for 100 milliseconds. For more information, see below.\r\n\r\n### Mobile Support ###\r\n\r\nPush can be used on Android Chrome (apparently Safari on iOS does not have notification support), but the website in which it is running on ***must*** use have a valid SSL certificate (HTTPS only!!) otherwise it will not work. This is due to Google's [decision to drop the Notification constructor](https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/BygptYClroM) from mobile Chrome. Sucks but hey, that's life, am I right?\r\n\r\n### See It In Action ###\r\n\r\nBefore you go out and try Push for yourself, you probably want to confirm it actually works in your browser, right?\r\n\r\nLucky for you a demo is available [here](http://nickersoft.github.io/push.js/demo.html).\r\n\r\n### Credits ###\r\nPush is based off work the following work:\r\n\r\n1. [HTML5-Desktop-Notifications](https://github.com/ttsvetko/HTML5-Desktop-Notifications) by [Tsvetan Tsvetkov](https://github.com/ttsvetko)\r\n2. [notify.js](https://github.com/alexgibson/notify.js) by [Alex Gibson](https://github.com/alexgibson)\r\n",
55
"google": "UA-24989915-5",
66
"note": "Don't delete this file! It's used internally to help with page regeneration."
77
}

0 commit comments

Comments
 (0)