Skip to content

kristianmandrup/aster-runner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aster-runner

NPM version Build Status

Task observer for aster.

Usage

This module is part of aster and is available via aster.runner.

You use it in build scripts whenever you want build pipeline (which is lazy by default) to be executed:

var aster = require('aster');

aster.src('src/**/*.js')
.map(plugin1(optionsForPlugin1))
.map(plugin2(optionsForPlugin2))
// ...
.subscribe(aster.runner({
    onNext: (item) => {
        console.log('>> %s'.yellow, item)
    }
}));

When you create an Observable, you always pass 3 functions in this order:

  • successHandler
  • errorHandler
  • onCompleteHandler

The success or error handler is called for each processed event/item of the Observable stream, the onComplete handler when the stream is done (such as no more files to be processed).

The default event handlers are:

function onFile(file) {
  console.log('>> %s'.yellow, file.path)
}

function onError(error) {
  console.error(error.stack.red)
}

function onCompleted() {
  console.log('Done.'.green)
}

Where onFile is used for onSuccess and expects a file object with a path.

API

runner

Type: Rx.Observer

options.onSuccess

Success event handler for individual item/event processed.

options.onError

Error event handler for individual item/event processed.

options.onCompleted

Completed handler for when entire stream of events/items of Observable has been processed.

License

MIT License

About

Task observer for aster.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%