fix(core): update

This commit is contained in:
Philipp Kunz 2019-09-29 16:35:12 +02:00
parent 771c454411
commit 90ae869686
3 changed files with 335 additions and 473 deletions

764
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,20 +21,20 @@
},
"homepage": "https://gitlab.com/pushrocks/smartchok#README",
"dependencies": {
"@pushrocks/lik": "^3.0.5",
"@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartrx": "^2.0.3",
"@pushrocks/lik": "^3.0.11",
"@pushrocks/smartpromise": "^3.0.5",
"@pushrocks/smartrx": "^2.0.5",
"@types/chokidar": "^2.1.3",
"chokidar": "^3.0.1"
"chokidar": "^3.1.1"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.11",
"@gitzone/tsrun": "^1.2.6",
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/smartfile": "^7.0.2",
"@pushrocks/tapbundle": "^3.0.9",
"@types/node": "^12.0.4",
"tslint": "^5.17.0",
"@pushrocks/smartfile": "^7.0.5",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.8",
"tslint": "^5.20.0",
"tslint-config-prettier": "^1.18.0"
},
"files": [

View File

@ -17,9 +17,9 @@ export type TFsEvent =
* Smartchok allows easy wathcing of files
*/
export class Smartchok {
watchStringmap = new Stringmap();
chokidarOptions: plugins.chokidar.WatchOptions;
status: TSmartchokStatus = 'idle';
public watchStringmap = new Stringmap();
public chokidarOptions: plugins.chokidar.WatchOptions;
public status: TSmartchokStatus = 'idle';
private watcher: plugins.chokidar.FSWatcher;
private watchingDeferred = plugins.smartpromise.defer<void>(); // used to run things when watcher is initialized
private eventObservablemap = new plugins.smartrx.Observablemap(); // register one observable per event
@ -35,24 +35,24 @@ export class Smartchok {
/**
* adds files to the list of watched files
*/
add(pathArrayArg: string[]) {
public add(pathArrayArg: string[]) {
this.watchStringmap.addStringArray(pathArrayArg);
}
/**
* removes files from the list of watched files
*/
remove(pathArg: string) {
public remove(pathArg: string) {
this.watchStringmap.removeString(pathArg);
}
/**
* gets an observable for a certain event
*/
getObservableFor(fsEvent: TFsEvent): Promise<plugins.smartrx.rxjs.Observable<any>> {
let done = plugins.smartpromise.defer<plugins.smartrx.rxjs.Observable<any>>();
public getObservableFor(fsEvent: TFsEvent): Promise<plugins.smartrx.rxjs.Observable<any>> {
const done = plugins.smartpromise.defer<plugins.smartrx.rxjs.Observable<any>>();
this.watchingDeferred.promise.then(() => {
let eventObservable = this.eventObservablemap.getObservableForEmitterEvent(
const eventObservable = this.eventObservablemap.getObservableForEmitterEvent(
this.watcher,
fsEvent
);
@ -65,8 +65,8 @@ export class Smartchok {
* starts the watcher
* @returns Promise<void>
*/
start(): Promise<void> {
let done = plugins.smartpromise.defer<void>();
public start(): Promise<void> {
const done = plugins.smartpromise.defer<void>();
this.status = 'starting';
this.watcher = plugins.chokidar.watch(
this.watchStringmap.getStringArray(),
@ -83,8 +83,8 @@ export class Smartchok {
/**
* stop the watcher process if watching
*/
stop() {
let closeWatcher = () => {
public stop() {
const closeWatcher = () => {
this.watcher.close();
};
if (this.status === 'watching') {