Node-WebKit推送信息调研

Node-WebKit推送信息调研

番茄工做法的流程 

一、 父窗口与弹出框交互:传/回参数。html

二、 消息框的触发方式:时间/点击。node

三、 基本流程:弹出下一个任务,是否继续:Y/N,默认为Yjquery

四、 实例git

Demo网址:github

http://alloyteam.github.io/AlloyTimer/web

改成消息弹出框的形式来表示chrome

Node-webkit的源码

https://github.com/rogerwang/node-webkitjson

提供多个版本windows

0.9.2: (Feb 20, 2014, based off of Node v0.11.9, Chrome 32.0.1700.107) api

v0.10.0-rc2: (Jul 18, 2014, based off of Node v0.11.13, Chromium 35.0.1916.113) 

0.8.6: (Apr 18, 2014, based off of Node v0.10.22, Chrome 30.0.1599.66)

API说明:

https://github.com/rogerwang/node-webkit/wiki

node-webkit框架不支持window.notification,可是webkit内核是支持window.notification。为何会不支持呢?

 

Window.webkitNotification

1、目前主流的web应用(QQ)的消息提醒都是由Window.webkitNotification实现的。

2chrome35版本(2014.5月末宣布)后不支持Window.webkitNotification

Node-webkit version

0.8.6

0.9.2(NercOA)

0.10.0

Node.js version

0.10.22

0.11.9

0.11.13pre

Browser version

Chrome30.0.1599.66

Chromium32.0.1700.17

Chromium35.0.1916.113

Support webkitNotification

Х

Support notification

 

Window.Notifications

窗口应用的API

1Browser compatibility(兼容性)

  • Desktop

Feature

Chrome

Firefox (Gecko)

Internet Explorer

Opera

Safari

Basic support

5 webkit (see notes) 22

4.0 moz (see notes) 22

Not supported

?

6 (see notes)

2Chrome notes

 

现有的消息弹出框

1Chrome自带的APP应用:Eye Rest Notification

 

2Chrome-app-samples/rich-notification

源码:

https://github.com/GoogleChrome/chrome-app-samples/tree/master/rich-notifications

文档:

https://developer.chrome.com/apps/notifications

 

NERCOA源文件

 

弹出窗口的触发事件

nw-desktop-notifications-rest

nw-desktop-notifications-work

弹出框定义

alloytimer

node-webkit-chrome-api-stubs-master

chrome api 根是为了node-webkit更好地调用现存的chromium app,保证明现常有的chrom apis功能,起码不会抛出错误。

Node Webkit Notification

node-webkit 0.9.1不支持webkitNotifications,因此chrome API根经过改写webkitNotification API 包装了nw-desktop-notification 库。

 

已经调通,父窗口弹出子窗口,子窗口带有边框。

A、 最新版本的node-webkit不能够运行该程序

B、 nercOA1.5.3版本能够运行该程序

 

源码:

https://github.com/jamesmortensen/node-webkit-chrome-api-stubs

 

 

nw-desktop-notifications

已经调通,能够在右上方弹出一个对话框。

注:须要修改index.htmlnw-desktop-notification.html的连接:

A、下载jquery.min.js文件

B、将修改成script src="./jquery.min.js"></script>

其是node-webkit-chrome-api-stubs-master消息推送的改进版本。

 

基于窗口的消息推送,有窗口边框,将窗口边框去除了。当最小化后,程序就关闭了;消息间的传递效果很差(赟鹏)。

源码:

https://github.com/robrighter/nw-desktop-notifications

 

特色:不稳定,修改几回代码就会出现没法弹出对话框。

关闭父窗口后,消息框不会自动消息(关闭父窗口时,消息框也须要关闭)

 

程序的流程:

Index.html—nw-desktop-notifications.js--nw-desktop-notification.html

node-desktop-notifications-master

未调试成功

须要使用到socket.io

Jquery.notification

基于windows notification内核的消息推送demo,在右侧方弹出消息框,界面的效果好。能够打开页面,可是不能弹出消息。 

效果展现页面:

http://azproduction.ru/jquery.notification/

源码:

https://github.com/azproduction/jquery.notification

 

 

 

讨论问题:

一、 node-webkit的消息推送有大量的依赖性

Take at notifications for node-webkit with a shitload of dependencies (Require.js, chaplin, TWEEN.js and so on).. sorry for that.

http://www.snip2code.com/Snippet/1525/Take-at-notifications-for-node-webkit-wi/

github的源码:

https://gist.github.com/miklschmidt/5896306

 

2Node-webkit:子窗口调用父窗口

https://github.com/rogerwang/node-webkit/issues/456

 

 

附:node-webkit程序运行实例

You may also be interested in our demos repository and the List of apps and companies using node-webkit.

Quick Start

Create index.html:

<!DOCTYPE html>

<html>

  <head>

    <title>Hello World!</title>

  </head>

  <body>

    <h1>Hello World!</h1>

    We are using node.js <script>document.write(process.version)</script>.

  </body>

</html>

Create package.json:

{

  "name": "nw-demo",

  "main": "index.html"

}

Compress index.html and package.json into a zip archive called app.nw:

$ zip app.nw index.html package.json

This should create a structure like this:

app.nw

|-- package.json

`-- index.html

Download the prebuilt binary for your platform and use it to open the app.nw file:

$ ./nw app.nw

Note: on Windows, you can drag the app.nw to nw.exe to open it.

相关文章
相关标签/搜索