Skip to content

Commit

Permalink
fork
Browse files Browse the repository at this point in the history
  • Loading branch information
aofong committed Feb 25, 2019
0 parents commit dd921a8
Show file tree
Hide file tree
Showing 11 changed files with 3,213 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

# nwjs-nsis-compat-updater

> Fork from https://github.com/evshiron/nwjs-builder-phoenix
> Remove electron dependencies
`nsis-compat-updater` is an auto updater implementation for NW.js, inspired by `electron-updater`.

## API

### Imports

```javascript
import { NsisCompatUpdater } from 'nsis-compat-updater';
// Or
// const { NsisCompatUpdater } = require('nsis-compat-updater');
```

### Types

```typescript

interface IInstaller {
arch: string;
path: string;
hash: string;
created: number;
}

interface IUpdater {
arch: string;
fromVersion: string;
path: string;
hash: string;
created: number;
}

interface IVersion {
version: string;
changelog: string;
source: string;
installers: IInstaller[];
updaters: IUpdater[];
}

interface IStreamProgress {
percentage: number;
transferred: number;
length: number;
remaining: number;
eta: number;
runtime: number;
delta: number;
speed: number;
}

```
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "nwjs-nsis-compat-updater",
"version": "1.2.1",
"description": "",
"main": "./dist/bundle.js",
"scripts": {
"prepublish": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"repository": {
"type": "git",
"url": "git+https://github.com/aofong/nwjs-nsis-compat-updater.git"
},
"author": "evshiron",
"license": "MIT",
"bugs": {
"url": "https://github.com/evshiron/nwjs-builder-phoenix/issues"
},
"homepage": "https://github.com/evshiron/nwjs-builder-phoenix#readme",
"devDependencies": {
"@types/bluebird-global": "^3.5.1",
"@types/node": "^7.0.12",
"@types/semver": "^5.3.31",
"@types/tmp": "0.0.32",
"awesome-typescript-loader": "^3.1.2",
"bluebird": "^3.5.0",
"debug": "^2.6.3",
"got": "^6.7.1",
"nwjs-builder-phoenix": "^1.9.3",
"progress-stream": "^1.2.0",
"semver": "^5.3.0",
"tmp": "0.0.31",
"tslint": "^5.0.0",
"typescript": "^2.2.2",
"webpack": "^2.4.1"
}
}
2 changes: 2 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

declare const nw: any;
Empty file added src/index.ts
Empty file.
22 changes: 22 additions & 0 deletions src/lib/Event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

export class Event<TArgs> {

public listeners: Array<(args: TArgs) => void> = [];

constructor(name: string) {

}

public subscribe(fn: ((args: TArgs) => void)) {
this.listeners.push(fn);
}

public trigger = (args: TArgs) => {
this.listeners.map(fn => fn(args));
}

public unsubscribe(fn: ((args: TArgs) => void)) {
this.listeners = this.listeners.filter(f => f != fn);
}

}
Loading

0 comments on commit dd921a8

Please sign in to comment.