Giter VIP home page Giter VIP logo

nodelike's Introduction

Important: This project is no longer maintained. The code is still available, but please don't regard it as anything but a hack. Please do not open new support tickets.

Nodelike Build Status Coverage Status Gitter chat

Nodelike the core framework of the Node.app project. The Node.app project has the goal to implement a roughly Node.JS-compatible interface using JavaScriptCore.framework on iOS 7 and OS X Mavericks.

(JavaScriptCore hasn't been available before iOS 7, and on OS X the project makes extensive use of the newly-updated 10.9-only Objective-C API. Previously on 10.8 there existed only a very low-level and very verbose C API.)

This is currently in an incomplete state, and not yet viable for serious use.

The goals

Node.app aims to provide a way to create or enrich applications for iOS and OS X Mavericks using Javascript with a Node.JS-compatible API. This will be done lightweight manner, because Node.app utilises the JavaScriptCore system framework and doesn't need to bundle a heavy-weight third-party javascript engine.

Specifically the goals are:

  • to be drop-in compatible with node.js 0.11.11
  • to be very lightweight
  • to reuse javascript code from node (/lib)
  • to provide the most minimal binding that is possible (via libuv)
  • NOT to archieve Node.js performance (this is meant as a client-side, not a server-side application)
  • NOT to be backwards-compatible (newest iOS/OS X required)

How it compares to existing approaches

node-webkit

The node-webkit project lets you create desktop applications for OS X by combining a Chromium web view with the Node.js project, both using the V8 javascript engine.

The Node.app project also lets you create desktop applications for OS X, but by enriching a JavaScriptCore context (e.g. a WebKit web view context) with Node.js-compatible interfaces. By doing that, the resulting applications are more lightweight, since no engine needs to be bundled. Another important difference is that applications using Node.app technology are fully AppStore compatible, unlike node-webkit applications.

MacGap / Phonegap-mac

The MacGap project provides a way to create desktop applications for OS X using JavaScript. It enriches a WebKit context with functions to operate OS X desktop functions, such as hiding/closing/resizing windows, playing sound or operating the dock.

As such, it can be combined with the Node.app project, to get the best of both worlds, Node.js compatibility as well as OS X specific desktop functions.

Apache Cordova / PhoneGap

Apache Cordova is a set of device APIs that allow a mobile app developer to access native device function such as the camera or accelerometer from JavaScript.

Apache Cordova is available for multiple platforms, but when focussing on the iOS platform, it too can be combined with the Node.app project to get the best of both worlds.

What's working right now

  • console.log()
  • process: .argv, .env, .exit(), .nextTick()
  • require()
  • fs
  • net
  • http
  • timers
  • util
  • url
  • events
  • path
  • stream
  • querystring
  • punycode
  • assert

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C. See the "Getting Started" guide for more information.

Podfile

pod 'Nodelike', :git => 'https://github.com/node-app/Nodelike.git', :branch => 'stable', :submodules => true

How to compile

You most likely want to use the stable brach, by git checkout stable.

You then need to fetch the nodejs submodule. Do so by:

  1. git submodule init
  2. git submodule update

Afterwards, just open Nodelike.xcodeproj, build the framework and you're all set!

How to use

First, attach Nodelike to a Javascript Context by NLContext#attachToContext:(JSContext *). This exposes the Node APIs to the global object of the context.

You can then execute some javascript via JSContext#evaluateScript:(NSString *).

Afterwards, you need to run the event loop via NLContext#runEventLoopSync or NLContext#runEventLoopAsync.

In the end, when you executed all scripts you wanted to, you can simulate the shutdown of the Node.js process via NLContext#emitExit:(JSContext *).

For more information, take a look at the wiki.

nodelike's People

Contributors

andreyvit avatar jacereda avatar kimar avatar ryan-mars avatar srijs avatar zetachang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.