zoukankan      html  css  js  c++  java
  • Node-WebKit推送信息调研

    Node-WebKit推送信息调研

    番茄工作法的流程 

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

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

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

    4、 实例

    Demo网址:

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

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

    Node-webkit的源码

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

    提供多个版本

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

    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

     

     

     

    讨论问题:

    1、 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.

     

  • 相关阅读:
    Async、Await
    CommandLineParser命令行解析类
    Dispose in c#
    授权oAuth
    Hadoop技术内幕1——源代码环境准备
    postgreSql——时区问题
    Linux命令3——c
    Linux命令2——b
    Linux命令1——a
    hadoop的Linux操作
  • 原文地址:https://www.cnblogs.com/yuanloo/p/4329854.html
Copyright © 2011-2022 走看看