add .reload()

This commit is contained in:
2017-04-09 16:05:24 +02:00
parent 6e079e38c3
commit d6a7fd6c8c
3 changed files with 43 additions and 27 deletions

View File

@ -32,7 +32,7 @@ export class Smartbrowser {
/**
* starts the server and returns the browserSync instance in a resolved Promise
*/
start (): Promise<plugins.browserSync.BrowserSyncInstance> {
async start (): Promise<plugins.browserSync.BrowserSyncInstance> {
let done = plugins.smartq.defer<plugins.browserSync.BrowserSyncInstance>()
if (this.bsStatus === 'idle') {
this.bsStatus = 'starting'
@ -46,17 +46,18 @@ export class Smartbrowser {
} else {
this.bsStarted.then(() => { done.resolve(this.bsInstance) })
}
return done.promise
return await done.promise
}
/**
* stops the smartbrowser instance
*/
stop (): Promise<void> {
let done = plugins.smartq.defer<void>()
async stop (): Promise<void> {
this.bsInstance.exit()
this.bsStatus = 'idle'
done.resolve()
return done.promise
}
async reload (): Promise<void> {
this.bsInstance.reload()
}
}