開發桌面應用的 JS 庫:AppJS

openkk 12年前發布 | 60K 次閱讀 JS JavaScript開發工具包

 開發桌面應用的 JS 庫:AppJS
AppJS 是一個令人振奮的 JavaScript 庫,使我們能夠使用 Web 技術快速開發桌面應用程序(HTML,CSS和JavaScript)。AppJS 使用 Node.js 做為后端支持。

示例代碼:

/**
 * Begin by requiring appjs.
 **/
var app = require('appjs');

// serve files to browser requests to "http://appjs/*"
app.serveFilesFrom(path.resolve(__dirname, 'public'));


/**
 * There are other routing functions that you can use like `post`, `get` or `all`.
 **/
app.post('/',function(req,res,next){
  res.send('Hey! How are you '+req.post('firstname'));
})

/**
 * Create a window and point it to http://appjs/. This url is a special url. 
 * It is not a http request. AppJS manages these requests manually using routers you define.
 **/
var window = app.createWindow('http://appjs/', {
  width           : 640,
  height          : 460,
  left            : -1,    // optional, -1 centers
  top             : -1,    // optional, -1 centers
  autoResize      : false, // resizes in response to html content
  resizable       : true, // controls whether window is resizable by user
  showChrome      : true,  // show border and title bar
  opacity         : 1,     // opacity from 0 to 1 (Linux)
  alpha           : false, // alpha composited background (Windows & Mac)
  fullscreen      : false, // covers whole screen and has no border
  disableSecurity : true   // allow cross origin requests
});

/**
 * This event is fired when window is ready and loading the first page is finished.
 **/
window.on("ready",function(){
  console.log("Event Ready called");

  this.frame.show();

});

項目主頁:http://www.baiduhome.net/lib/view/home/1345733037876

 本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!