-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
Parallel
applicative and also breakingly...
...changed `template` and `apply` to work in parallel and renamed `[upH|downH|h]asFailed` to `[upH|downH|h]asErrored`.
- Loading branch information
Showing
9 changed files
with
631 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
window.L = window.Kefir.partial.lenses | ||
window.XHR = window.karet.xhr | ||
window.log = function() { | ||
var Kefir = window.Kefir | ||
var log = console.log | ||
var xs = [] | ||
for (let i = 0; i < arguments.length; ++i) { | ||
var x = arguments[i] | ||
xs.push(x instanceof Kefir.Observable ? x : Kefir.constant(x)) | ||
} | ||
var log = console.log | ||
function logs(xs) { | ||
log.apply(console, xs) | ||
} | ||
Kefir.combine(xs).observe(logs, logs) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import * as I from 'infestines' | ||
import * as K from 'kefir' | ||
|
||
const TIMER = 't' | ||
const SOURCE = 's' | ||
const HANDLER = 'h' | ||
|
||
const TYPE = 'type' | ||
const VALUE = 'value' | ||
const END = 'end' | ||
|
||
const DelayUnsub = I.inherit( | ||
function DelayUnsub(source) { | ||
const self = this | ||
K.Property.call(self) | ||
self[SOURCE] = source | ||
self[HANDLER] = self[TIMER] = 0 | ||
}, | ||
K.Property, | ||
{ | ||
_onActivation() { | ||
const self = this | ||
if (self[TIMER]) { | ||
clearTimeout(self[TIMER]) | ||
self[TIMER] = 0 | ||
} else { | ||
self[SOURCE].onAny( | ||
(self[HANDLER] = e => { | ||
const t = e[TYPE] | ||
if (t === VALUE) { | ||
self._emitValue(e[VALUE]) | ||
} else if (t === END) { | ||
self._emitEnd() | ||
} else { | ||
self._emitError(e[VALUE]) | ||
} | ||
}) | ||
) | ||
} | ||
}, | ||
_onDeactivation() { | ||
const self = this | ||
self[TIMER] = setTimeout(() => { | ||
self[SOURCE].offAny(self[HANDLER]) | ||
self[HANDLER] = self[TIMER] = 0 | ||
}, 0) | ||
} | ||
} | ||
) | ||
|
||
export const delayUnsub = source => new DelayUnsub(source) |
Oops, something went wrong.