Atom Shell 1. 程序入口2. 编译系统3. Node 集成4. Multi-context 开发桌面应用框架

程序名称:Atom Shell 1. 程序入口2. 编译系统3. Node 集成4. Multi-context

授权协议: MIT

操作系统: 跨平台

开发语言: C/C++

Atom Shell 1. 程序入口2. 编译系统3. Node 集成4. Multi-context 介绍

Atom Shell 现已改名为 Electron

atom-shell 是 GitHub 随 Atom 一起开源的跨操作系统(Windows,Linux,MacOS X)的利用 Web
技术(Node.js、JavaScript、HTML 5)开发桌面应用的框架。Atom即构建在 atom-shell 之上。

与 Node-Webkit 的区别

atom-shell 和Node-Webkit很像,那么两者有什么区别呢?

1. 程序入口

Node-Webkit 的程序入口是一个网页,你在package.json中指定主页,然后这个主页会在浏览器中打开,作为应用程序的主窗口。

atom-shell 的程序入口则是一个 JavaScript 脚本,而不是直接指定一个 URL。你需要手动创建浏览器窗口,并通过相应的 API 加载
html 文件。你同时需要监听窗口事件以便决定何时退出应用。

因此,atom-shell 更接近 Node.js 运行时,API 也更加底层,你可以利用 atom-shell 进行 web
测试,类似phantomjs

2. 编译系统

atom-shell
使用libchromiumcontent访问
Chromium 的 Content API,这样编译 atom-shell 的时候就不用编译整个 Chromium (编译 Chromium 非常费时)。

顺便提一下,GitHub 开发者还创建了brightray库,让
libchromiumcontent 的使用更方便。

3. Node 集成

Node-Webkit 的 Node 集成需要给 Chromium 打补丁才能工作。atom-shell 通过集成 libuv loop 和 平台的
message loop 避免给 Chromium 打补丁。

4. Multi-context

Node-Webkit 创造了 Node context 和 web context 的概念,而 atom-shell 没有引入新的
context,而是直接使用 Node 的 Multi-context 特性(这一特性是 Atom 开发者赞助 Node 添加的)。

作者

GitHub 最初考察了 Node-
Webkit,但是最终还是决定雇佣@zcbenz来开发想要的框架。于是 atom-shell
诞生了。

一个最简单的 hello atom 示例项目请看 hello-atom

主程序示例:

var app = require('app');  // Module to control application life.
var BrowserWindow = require('browser-window');  // Module to create native browser window.

// Report crashes to our server.
require('crash-reporter').start();

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
  if (process.platform != 'darwin')
    app.quit();
});

// This method will be called when atom-shell has done everything
// initialization and ready for creating browser windows.
app.on('ready', function() {
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 800, height: 600});

  // and load the index.html of the app.
  mainWindow.loadUrl('file://' + __dirname + '/index.html');

  // Emitted when the window is closed.
  mainWindow.on('closed', function() {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });
});

支持很多桌面应用特性,例如 Dock 菜单等:

使用 Dock 菜单的方法:

var app = require('app');
var Menu = require('menu');
var dockMenu = Menu.buildFromTemplate([
  { label: 'New Window', click: function() { console.log('New Window'); } },
  { label: 'New Window with Settings', submenu: [
    { label: 'Basic' },
    { label: 'Pro'},
  ]},
  { label: 'New Command...'},
]);
app.dock.setMenu(dockMenu);

PS:网易也有开放了Hex,同样是不满意node-webkit,就自己做了套.

Atom Shell 1. 程序入口2. 编译系统3. Node 集成4. Multi-context 官网

https://github.com/atom/atom-shell

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Pangu 是 Atom 编辑器插件,可以在中文和英文字符之间添加空格字符。算法来自 paranoid-auto-
Netconf for ATOM 是诺基亚开发的一个用来学习和测试 NETCONF 协议的Atom 编辑器插件,该插件包含一个 NETCONF 客户端。
vim-mode 是一项正在进行的 Atom 包的工作,通过连接到 Neovim 实现了完整的 vim 的绑定。
APICloud 为 Atom 编辑器推出的开发工具包。包含新建应用模板,页面模板,WiFi 真机同步,流式日志输出等核心功能。
Atom Shell 现已改名为 Electron atom-shell 是 GitHub 随 Atom 一起开源的跨操作系统(Windows,Linux,MacOS X)的利用 Web
ATOM-Gitee (前身是 ATOM-GitOSC),ATOM 的 码云扩展。只要在 ATOM 上安装了码云插件,就可以直接用 ATOM 编辑器来管理码云上的项目啦。既节省了时间,也简化了原本相对比较繁琐的步骤。
Hydrogen 是一个开发包,允许你直接在 Atom 上使用任何已安装的Jupyter 内核来运行内连代码。它的设计灵感来自于反馈瞬时值和Light
Nuclide 是 Facebook 推出的一套基于 Atom 的开发工具集。用于开发基于 Hack 的 Web 应用。提供自动完成和
Ionide 是 Atom 编辑器的 F# 跨平台开发扩展。 主要特性: 开发 F#:提供现代 IDE 所需要的所有特性:自动完成,工具提示,文档格式化,语法和错误高亮等等。
listtosql 是一个简单的 Visual Studio Code 扩展,用来将一组字符串列表转成以逗号分隔的表达方式,以便在 SQL 语句中使用。
Visual Studio Code 的 MySQL 管理工具 功能 管理 MySQL 连接 查看 MySQL 服务器 查看 MySQL 数据库
code-server 是一个可以在远程服务器上运行 VS Code 的工具。 通过浏览器访问,它可以让你:
VSC Netease Music 是一个非官方的 Visual Studio Code 的网易音乐扩展。 Feature 使用 Webview 实现,通过
这是一个灵感来自 Synthwave 的 Visual Studio Code 的色彩主题。 效果图:
Fabulous 为 Visual Studio Code 编辑器引入一个 CSS 属性编辑器的功能。 Fabulous 支持如下特性:
Microsoft Web Template Studio (WebTS) 是一种 Visual Studio Code 扩展,可基于向导加速创建新的
dongbei-vscode 是东北话编程语言 dongbei 的 VS Code 语法高亮插件。 特性 亮就完事了。
Code Runner for VS Code支持了超过 30 种语言: C, C++, Java, JavaScript, PHP, Python, Perl, Ruby, Go, Lua, Groovy, PowerShell, BAT/CMD, BASH/SH, F# Script, C#
xmake-vscode一个集成xmake的Visual Studio Code插件 简介 一个集成xmake的Visual Studio Code插件.
Kiwi是阿里巴巴开源的国际化解决方案,kiwi 不仅仅一个软件国际化的代码库,而是国际化从设计到发布的整个流程的一整套解决方案。目前有很多成熟的库可以帮助前端去做对应的国际化方案,比较知名的有