Skip to content

Commit 33d8059

Browse files
committed
Create gh-pages branch via GitHub
1 parent 87a31c1 commit 33d8059

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

index.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ <h3>
2424

2525
<p>Push 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, 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.</p>
2626

27+
<h4>
28+
<a id="creating-notifications" class="anchor" href="#creating-notifications" aria-hidden="true"><span class="octicon octicon-link"></span></a>Creating Notifications</h4>
29+
2730
<p>So just how easy is it to create a notification using Push? We can do it in just one line, actually:</p>
2831

2932
<div class="highlight highlight-javascript"><pre>Push.create(<span class="pl-s"><span class="pl-pds">'</span>Hello World!<span class="pl-pds">'</span></span>)</pre></div>
@@ -34,6 +37,31 @@ <h3>
3437
Push.create(<span class="pl-s"><span class="pl-pds">'</span>Hello World!<span class="pl-pds">'</span></span>);
3538
});</pre></div>
3639

40+
<h4>
41+
<a id="closing-notifications" class="anchor" href="#closing-notifications" aria-hidden="true"><span class="octicon octicon-link"></span></a>Closing Notifications</h4>
42+
43+
<p>When 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 object and 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:</p>
44+
45+
<div class="highlight highlight-javascript"><pre>Push.create(<span class="pl-s"><span class="pl-pds">'</span>Hello World!<span class="pl-pds">'</span></span>, {
46+
tag<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">'</span>foo<span class="pl-pds">'</span></span>
47+
});
48+
49+
<span class="pl-c">// Somewhere later in your code...</span>
50+
51+
Push.<span class="pl-c1">close</span>(<span class="pl-s"><span class="pl-pds">'</span>foo<span class="pl-pds">'</span></span>);</pre></div>
52+
53+
<p>Alternatively, you can assign the Notification wrapper returned by Push to a variable and close it directly:</p>
54+
55+
<div class="highlight highlight-javascript"><pre><span class="pl-k">var</span> notification <span class="pl-k">=</span> Push.create(<span class="pl-s"><span class="pl-pds">'</span>Hello World!<span class="pl-pds">'</span></span>);
56+
57+
<span class="pl-c">// Somewhere later in your code...</span>
58+
59+
notification.<span class="pl-c1">close</span>();</pre></div>
60+
61+
<p>When it comes to clearing all open notifications, that's just as easy as well:</p>
62+
63+
<div class="highlight highlight-javascript"><pre>Push.<span class="pl-c1">clear</span>();</pre></div>
64+
3765
<h3>
3866
<a id="options" class="anchor" href="#options" aria-hidden="true"><span class="octicon octicon-link"></span></a>Options</h3>
3967

params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"name":"Push.js","tagline":"A compact, cross-browser solution for Javascript desktop notifications","body":"### 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, 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\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\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","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
1+
{"name":"Push.js","tagline":"A compact, cross-browser solution for Javascript desktop notifications","body":"### 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, 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\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\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 object and 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 wrapper returned by Push to a variable and close it directly:\r\n\r\n```javascript\r\nvar notification = Push.create('Hello World!');\r\n\r\n// Somewhere later in your code...\r\n\r\nnotification.close();\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","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}

0 commit comments

Comments
 (0)