Code Monkey home page Code Monkey logo

node-webkit.dart's Introduction

Introduction

node-webkit.dart is a Dart package to build node-webkit apps.

To see how the node-webkit's API looks like in Dart, check out the sample application here. Just download the dart_examples.nw archive, and open it with node-webkit.

$ nw dart_examples.nw

Features

This package provides the following libraries:

  • nw_gui.dart: A wrapper to the nw_gui module
  • path.dart: A wrapper to the path module
  • node_filesystem.dart: A wrapper to the fs module
  • dart_filesystem.dart: A complement to the node-filesystem library, wich provides the FileSystemEntity, File, Directory and Link classes, so you can access the filesystem just as you would do with dart:io
  • os.dart: A wrapper to the OS module
  • nodejs_module_wrapper.dart: A helper library for wrapping nodejs's modules

Quick Start

  • Create a Dart package (you can follow the instructions here)
  • Add node-webkit.dart as a dependency in pubspec.yaml file
name: my_app
 dependencies:
   node_webkit: any
  • Update dependencies:
$ pub get
  • Create a package.json file in web folder
{
  "name": "nw-demo",
  "main": "index.html"
}
  • Create a index.html file in web folder
<!DOCTYPE html>
<html>
  <head>
    <title>node-webkit.dart example</title>
  </head>
  
  <body>
    <script type="application/dart" src="index.dart"></script>
    <script src="packages/node_webkit/node_webkit.js"></script>
    <script src="packages/browser/dart.js"></script>

    <p id="msg"></p>
  </body>
</html>
  • And finally, create a index.dart file in web folder
import 'dart:html';
import 'package:node_webkit/nw_gui.dart' as gui;

main() {
  querySelector("#msg").text = "Hello, ${getUsername()}!";
}

String getUsername() {
  return gui.App.argv.length > 0 ? gui.App.argv[0] : "Unknown";
}
  • You can compile your app with dart2js
$ dart2js -o web/index.dart.js web/index.dart
$ nw web/ User

node-webkit.dart's People

Contributors

luizmineo avatar

Watchers

Hanxue avatar James Cloos 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.