fix Promise issues
This commit is contained in:
parent
af9eb0d99e
commit
7d4975cea8
5
dist/smartchok.classes.smartchok.d.ts
vendored
5
dist/smartchok.classes.smartchok.d.ts
vendored
@ -1,4 +1,3 @@
|
||||
/// <reference types="q" />
|
||||
import * as plugins from './smartchok.plugins';
|
||||
import { Stringmap } from 'lik';
|
||||
export declare type TSmartchokStatus = 'idle' | 'starting' | 'watching';
|
||||
@ -28,12 +27,12 @@ export declare class Smartchok {
|
||||
/**
|
||||
* gets an observable for a certain event
|
||||
*/
|
||||
getObservableFor(fsEvent: TFsEvent): plugins.q.Promise<plugins.rx.Observable<any>>;
|
||||
getObservableFor(fsEvent: TFsEvent): Promise<plugins.rx.Observable<any>>;
|
||||
/**
|
||||
* starts the watcher
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
start(): plugins.q.Promise<void>;
|
||||
start(): Promise<void>;
|
||||
/**
|
||||
* stop the watcher process if watching
|
||||
*/
|
||||
|
8
dist/smartchok.classes.smartchok.js
vendored
8
dist/smartchok.classes.smartchok.js
vendored
@ -12,7 +12,7 @@ class Smartchok {
|
||||
constructor(watchArrayArg, optionsArg = {}) {
|
||||
this.watchStringmap = new lik_1.Stringmap();
|
||||
this.status = 'idle';
|
||||
this.watchingDeferred = plugins.q.defer(); // used to run things when watcher is initialized
|
||||
this.watchingDeferred = plugins.smartq.defer(); // used to run things when watcher is initialized
|
||||
this.eventObservablemap = new plugins.lik.Observablemap(); // register one observable per event
|
||||
this.watchStringmap.addStringArray(watchArrayArg);
|
||||
this.chokidarOptions = optionsArg;
|
||||
@ -33,7 +33,7 @@ class Smartchok {
|
||||
* gets an observable for a certain event
|
||||
*/
|
||||
getObservableFor(fsEvent) {
|
||||
let done = plugins.q.defer();
|
||||
let done = plugins.smartq.defer();
|
||||
this.watchingDeferred.promise.then(() => {
|
||||
let eventObservable = this.eventObservablemap.getObservableForEmitterEvent(this.watcher, fsEvent);
|
||||
done.resolve(eventObservable);
|
||||
@ -45,7 +45,7 @@ class Smartchok {
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
start() {
|
||||
let done = plugins.q.defer();
|
||||
let done = plugins.smartq.defer();
|
||||
this.status = 'starting';
|
||||
this.watcher = plugins.chokidar.watch(this.watchStringmap.getStringArray(), this.chokidarOptions);
|
||||
this.watcher.on('ready', () => {
|
||||
@ -72,4 +72,4 @@ class Smartchok {
|
||||
}
|
||||
}
|
||||
exports.Smartchok = Smartchok;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjaG9rLmNsYXNzZXMuc21hcnRjaG9rLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRjaG9rLmNsYXNzZXMuc21hcnRjaG9rLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0NBQThDO0FBQzlDLDZCQUErQjtBQUsvQjs7R0FFRztBQUNIO0lBUUU7O09BRUc7SUFDSCxZQUFhLGFBQXVCLEVBQUUsYUFBNEMsRUFBRTtRQVZwRixtQkFBYyxHQUFHLElBQUksZUFBUyxFQUFFLENBQUE7UUFFaEMsV0FBTSxHQUFxQixNQUFNLENBQUE7UUFFekIscUJBQWdCLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQVEsQ0FBQSxDQUFDLGlEQUFpRDtRQUM1Rix1QkFBa0IsR0FBRyxJQUFJLE9BQU8sQ0FBQyxHQUFHLENBQUMsYUFBYSxFQUFFLENBQUEsQ0FBQyxvQ0FBb0M7UUFNL0YsSUFBSSxDQUFDLGNBQWMsQ0FBQyxjQUFjLENBQUMsYUFBYSxDQUFDLENBQUE7UUFDakQsSUFBSSxDQUFDLGVBQWUsR0FBRyxVQUFVLENBQUE7SUFDbkMsQ0FBQztJQUVEOztPQUVHO0lBQ0gsR0FBRyxDQUFDLFlBQXNCO1FBQ3hCLElBQUksQ0FBQyxjQUFjLENBQUMsY0FBYyxDQUFDLFlBQVksQ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QUFDLENBQUM7WUFDdEMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsUUFBUSxZQUFZLEVBQUUsQ0FBQSxDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQzlELENBQUM7SUFDSCxDQUFDO0NBQ0Y7QUF4RUQsOEJBd0VDIn0=
|
2
dist/smartchok.plugins.d.ts
vendored
2
dist/smartchok.plugins.d.ts
vendored
@ -2,7 +2,7 @@ import 'typings-global';
|
||||
export import lik = require('lik');
|
||||
export import chokidar = require('chokidar');
|
||||
export import path = require('path');
|
||||
export import q = require('q');
|
||||
export import smartq = require('smartq');
|
||||
export import rx = require('rxjs/Rx');
|
||||
import { Operator } from 'rxjs/Operator';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
4
dist/smartchok.plugins.js
vendored
4
dist/smartchok.plugins.js
vendored
@ -4,6 +4,6 @@ require("typings-global");
|
||||
exports.lik = require("lik");
|
||||
exports.chokidar = require("chokidar");
|
||||
exports.path = require("path");
|
||||
exports.q = require("q");
|
||||
exports.smartq = require("smartq");
|
||||
exports.rx = require("rxjs/Rx");
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjaG9rLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGNob2sucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qiw2QkFBa0M7QUFDbEMsdUNBQTRDO0FBQzVDLCtCQUFvQztBQUNwQyx5QkFBOEI7QUFDOUIsZ0NBQXFDIn0=
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjaG9rLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGNob2sucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qiw2QkFBa0M7QUFDbEMsdUNBQTRDO0FBQzVDLCtCQUFvQztBQUNwQyxtQ0FBd0M7QUFDeEMsZ0NBQXFDIn0=
|
@ -5,7 +5,7 @@
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "(npm run prepareTest && npmts)",
|
||||
"test": "(yarn run prepareTest && npmts)",
|
||||
"prepareTest": "(rm -f ./test/assets/hi.txt)"
|
||||
},
|
||||
"repository": {
|
||||
@ -20,10 +20,8 @@
|
||||
"homepage": "https://gitlab.com/pushrocks/smartchok#README",
|
||||
"dependencies": {
|
||||
"@types/chokidar": "^1.7.0",
|
||||
"@types/q": "x.x.x",
|
||||
"chokidar": "^1.7.0",
|
||||
"lik": "^1.0.32",
|
||||
"q": "^1.5.0",
|
||||
"rxjs": "^5.4.1",
|
||||
"smartipc": "^1.0.9",
|
||||
"smartq": "^1.1.1",
|
||||
|
@ -12,7 +12,7 @@ export class Smartchok {
|
||||
chokidarOptions: plugins.chokidar.WatchOptions
|
||||
status: TSmartchokStatus = 'idle'
|
||||
private watcher
|
||||
private watchingDeferred = plugins.q.defer<void>() // used to run things when watcher is initialized
|
||||
private watchingDeferred = plugins.smartq.defer<void>() // used to run things when watcher is initialized
|
||||
private eventObservablemap = new plugins.lik.Observablemap() // register one observable per event
|
||||
|
||||
/**
|
||||
@ -40,8 +40,8 @@ export class Smartchok {
|
||||
/**
|
||||
* gets an observable for a certain event
|
||||
*/
|
||||
getObservableFor (fsEvent: TFsEvent): plugins.q.Promise<plugins.rx.Observable<any>> {
|
||||
let done = plugins.q.defer<plugins.rx.Observable<any>>()
|
||||
getObservableFor (fsEvent: TFsEvent): Promise<plugins.rx.Observable<any>> {
|
||||
let done = plugins.smartq.defer<plugins.rx.Observable<any>>()
|
||||
this.watchingDeferred.promise.then(() => {
|
||||
let eventObservable = this.eventObservablemap.getObservableForEmitterEvent(this.watcher, fsEvent)
|
||||
done.resolve(eventObservable)
|
||||
@ -53,8 +53,8 @@ export class Smartchok {
|
||||
* starts the watcher
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
start(): plugins.q.Promise<void> {
|
||||
let done = plugins.q.defer<void>()
|
||||
start(): Promise<void> {
|
||||
let done = plugins.smartq.defer<void>()
|
||||
this.status = 'starting'
|
||||
this.watcher = plugins.chokidar.watch(this.watchStringmap.getStringArray(), this.chokidarOptions)
|
||||
this.watcher.on('ready', () => {
|
||||
|
@ -2,7 +2,7 @@ import 'typings-global'
|
||||
export import lik = require('lik')
|
||||
export import chokidar = require('chokidar')
|
||||
export import path = require('path')
|
||||
export import q = require('q')
|
||||
export import smartq = require('smartq')
|
||||
export import rx = require('rxjs/Rx')
|
||||
|
||||
// workaround
|
||||
|
@ -51,7 +51,7 @@
|
||||
version "0.0.27"
|
||||
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
||||
|
||||
"@types/q@1.x.x", "@types/q@x.x.x":
|
||||
"@types/q@1.x.x":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.0.1.tgz#dbccb01bd8f0f801a12a4604c7d7af59bb02ae2f"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user