Page MenuHomePhabricator
Paste P6342

(An Untitled Masterwork)
ActivePublic

Authored by EBernhardson on Nov 17 2017, 4:08 PM.
Tags
None
Referenced Files
F10847056:
Nov 17 2017, 4:08 PM
Subscribers
None
const BeforeOnce = ( options, fn ) => Before( options, function () {
return this.tags.check( options.tags ).then( ( status ) => {
if ( status === 'new' ) {
return fn.call ( this ).then( () => this.tags.complete( options.tags ) );
}
} );
} );
Converted to couroutine:
const BeforeOnce = ( options, fn ) => Before( options, Promise.coroutine( function* () {
let status = yield this.tags.check( options.tags );
if ( status === 'new' ) {
yield fn.call( this );
yield this.tags.complect( options.tags );
}
} ) );