Git Product home page Git Product logo

robertdigital / desktopjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from morganstanley/desktopjs

0.0 1.0 0.0 1.48 MB

desktopJS provides a common API across multiple HTML5 containers. By programming to a common API, applications can target multiple HTML5 containers without change.

Home Page: https://morgan-stanley.github.io/desktopJS

License: Apache License 2.0

JavaScript 4.46% TypeScript 95.43% CSS 0.06% Shell 0.05%

desktopjs's Introduction

desktopJS

npm version Build Status codecov Greenkeeper badge devDependencies Status dependencies Status GitPitch

desktopJS is a common API across multiple HTML5 containers. By programming to a common API, applications can target multiple HTML5 containers without change. Detecting what container in which you are hosted, desktopJS provides shims and polyfills to bridge the common API to the underlying container. The goal is to help applications be container agnostic and provide portability when multiple container deployments are desired.

Usage

The first step is to simply resolve the current container. This enumerates all registered containers (including your own custom container or derived custom implementations) and returns the container implementation that matches.

var container = desktopJS.resolveContainer();
console.log("Container: " + container.hostType);

Interact with the container via a single api instead of having conditional code or applications based on deployment.

container.addTrayIcon({ icon: 'assets/img/application.png', text: 'Example' }, () => {
	console.log("Icon clicked");
});

Building

The library uses gulp and rollup for building. All build dependencies are included as devDependencies and are installed during npm install.

$ npm install

Build the project. This runs static analysis, unit tests and bundles the output with rollup.

$ npm run build && npm test

For those using Visual Studio Code, tasks.json has a build task.

Development

Local Hosting

To run the examples or to manually test scenarios in each container, there is a gulp task providing a local server with live reload. This can be run directly via gulp or through npm.

$ npm start

This is configured to listen at http://localhost:8000 and will reload upon any change to the project build output under /dist or the web example under /examples/web. All of the included examples make use of this example application to showcase the portability of one codebase.

Unit tests

The tests can be run independent of the build.

$ npm test

A task is provided for Visual Studio Code users that can be launched from the command palette via

>Tasks: Run Test Task

or it is recommended to define a custom keyboard binding.

{
    "key": "ctrl+shift+t",
    "command": "workbench.action.tasks.test"
}

Examples

Examples showcasing usage of desktopJS for various containers and scenarios can be found under the examples directory.

desktopjs's People

Contributors

bingenito avatar greenkeeper[bot] avatar dependabot[bot] avatar anubhavbisaria avatar satlus avatar

Watchers

 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.