深挖微信小程序!你需要先了解这三个内核

5,670 阅读2分钟
原文链接: weappdev.com

以防你没看文档-微信小程序的相关运行平台

可能你目前还没有关注到微信小程序的运行机制,不过了解一下内容,可能对于你对微信小程序的认识会深刻和透彻一些。

  • 在 iOS 上,小程序的 javascript 代码是运行在 JavaScriptCore 中
  • 在 Android 上,小程序的 javascript 代码是通过 X5 内核来解析
  • 在 开发工具上, 小程序的 javascript 代码是运行在 nwjs(chrome内核) 中

JavaScriptCore

你知道吗,JavaScriptCores是开源的,下载地址github.com/phoboslab/J…

OS X Mavericks 和 iOS 7 引入了 JavaScriptCore 库,它把 WebKit 的 JavaScript 引擎用 Objective-C 封装,提供了简单,快速以及安全的方式接入世界上最流行的语言。不管你爱它还是恨它,JavaScript 的普遍存在使得程序员、工具以及融合到 OS X 和 iOS 里这样超快的虚拟机中资源的使用都大幅增长。

X5 内核

这个没啥好说的,唯一一个属于国人开发,大鹅厂自己的浏览器解析内核

nwjs

原名:node-webkit 当然也是开源的 github.com/nwjs/nw.js/

NW.js 是基于 Chromium和 Node.js运行的, 以前也叫nodeWebkit。这就给了你使用HTML和JavaScript来制作桌面应用的可能。在应用里你可以直接调用Node.js的各种api以及现有的第三方包。因为Chromium和 Node.js的跨平台,那么你的应用也是可以跨平台的。现在已经有很多知名的应用是基于NW.js实现,

  • 类似工具

Electron - Build cross platform desktop apps with JavaScript

  • 建议阅读
  • nwjs readme

nwjs/nw.js/blob/nw18/README.md

## node-webkit is renamed NW.js

[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/nwjs/nw.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)  
Official site: http://nwjs.io  
Official documentation: http://docs.nwjs.io/  
[Announcement](https://groups.google.com/d/msg/nwjs-general/V1FhvfaFIzQ/720xKVd0jNkJ)  
## Introduction

NW.js is an app runtime based on `Chromium` and `node.js`. You can 
write native apps in HTML and JavaScript with NW.js. It also lets you
call Node.js modules directly from the DOM and enables a new way of writing
native applications with all Web technologies.

It was created in the Intel Open Source Technology Center.

[Creating Desktop Applications With node-webkit](https://strongloop.com/strongblog/creating-desktop-applications-with-node-webkit/)     
[WebApp to DesktopApp with node-webkit (slides)](http://oldgeeksguide.github.io/presentations/html5devconf2013/wtod.html)  
[Essay on the history and internals of the project](http://yedingding.com/2014/08/01/node-webkit-intro-en.html)

## Features
NW.js 入坑指南5

最后

想成为一个合格的微信小程序开发工程师,不知道这些怎么可以,怎么装逼!!!怎么飞!!!

来源

微信小程序开发论坛

垂直微信小程序开发交流社区