Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton authored Sep 22, 2017
1 parent 2528b7a commit 77514c6
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,41 @@

**Custom widget support is only available for CNCjs 1.9.10 or later versions**

You can download a working example widget from the releases page:<br>
https://github.com/cncjs/cncjs-widget-boilerplate/releases

![image](https://user-images.githubusercontent.com/447801/30728983-b866f4b6-9f8e-11e7-9a90-6b712344d270.png)

## Installation

```bash
npm i -g npm # Upgrade NPM to the latest version
npm install
```

## Development Guide

Create a directory under <b>src/widgets</b> and put your code in there.

```
src/
widgets/
MyApp/index.js
```

When connecting to a local development server, you can specify the "widget" query parameter within your browser to switch between widgets (e.g. `http://localhost:5000/?widget=MyApp`).

### Query Parameters

Name | Description
:--- | :----------
token | (Required) An authentication token to enable secure communication. The token will be automatically set by CNCjs.
host | (Optional) Specifies the host to connect to. Defaults to an empty string.
widget | (Optional) Specifies a folder name under 'src/widgets'. Defaults to 'ReactApp'.

### Examples

#### React App

There is a widget written with React, you can download it from the releases page: https://github.com/cncjs/cncjs-widget-boilerplate/releases

![image](https://user-images.githubusercontent.com/447801/30728983-b866f4b6-9f8e-11e7-9a90-6b712344d270.png)

## Development

Run `npm run dev` to start a local development server for development, then connect to http://localhost:5000 and wait until bundle finished.
Expand Down

0 comments on commit 77514c6

Please sign in to comment.