UNPKG

rafa

Version:

Rafa.js is a Javascript framework for building concurrent applications.

19 lines (16 loc) 525 B
// # constructor(): EmptyEnumerator // An Enumerator that calls the callback with a DoneMessage when next is called // for the first time. function EmptyEnumerator() { this.complete = false; } inherit(EmptyEnumerator, Enumerator, { // # next(callback: A => _) // Call a callback, passing a DoneMessage, on the first call to this method. // Subsequent calls throw CompleteError. next(callback) { if (this.complete) throw this.CompleteError; this.complete = true; callback(this.doneMessage()); } });