Skip to content

Commit

Permalink
prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
limemloh committed May 29, 2017
1 parent 34bb3c7 commit 70a7b9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/now.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function sample<A>(b: Behavior<A>): Now<A> {
return new SampleNow(b);
}

class AsyncNow<A> extends Now<Future<A>> {
class PerformNow<A> extends Now<Future<A>> {
constructor(private comp: IO<A>) {
super();
}
Expand All @@ -87,8 +87,8 @@ class AsyncNow<A> extends Now<Future<A>> {
}
}

export function async<A>(comp: IO<A>): Now<Future<A>> {
return new AsyncNow(comp);
export function perform<A>(comp: IO<A>): Now<Future<A>> {
return new PerformNow(comp);
}

class PerformIOStream<A> extends ActiveStream<A> {
Expand Down
12 changes: 6 additions & 6 deletions test/now.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { testStreamFromObject } from "../src";
import { Behavior, switchTo, when, scan } from "../src/behavior";
import { Future } from "../src/future";
import {
async, Now, performStream, performStreamLatest,
perform, Now, performStream, performStreamLatest,
performStreamOrdered, plan, runNow, sample, testNow, loopNow
} from "../src/now";
import { Stream, sinkStream } from "../src/stream";
Expand Down Expand Up @@ -62,8 +62,8 @@ describe("Now", () => {
const ref1 = createRef(1);
const ref2 = createRef("Hello");
const comp =
async(mutateRef(2, ref1)).chain(
(_: any) => async(mutateRef("World", ref2)).chain(
perform(mutateRef(2, ref1)).chain(
(_: any) => perform(mutateRef("World", ref2)).chain(
(__: any) => Now.of(Future.of(true))
)
);
Expand All @@ -89,7 +89,7 @@ describe("Now", () => {
it("works with runNow", () => {
let resolve: (n: number) => void;
const promise = runNow(
async(callP((n: number) => new Promise((res) => resolve = res), 0))
perform(callP((n: number) => new Promise((res) => resolve = res), 0))
);
setTimeout(() => { resolve(12); });
return promise.then((result: number) => {
Expand Down Expand Up @@ -144,7 +144,7 @@ describe("Now", () => {
return Now.of(n * 2);
}
const prog = go(function* () {
const e: Future<number> = yield async(fn(1));
const e: Future<number> = yield perform(fn(1));
const e2 = yield plan(e.map((r) => comp(r)));
return e2;
});
Expand All @@ -167,7 +167,7 @@ describe("Now", () => {
});
function loop(n: number): Now<Behavior<number>> {
return go(function* () {
const e = yield async(getNextNr(1));
const e = yield perform(getNextNr(1));
const e1 = yield plan(e.map(loop));
return switchTo(Behavior.of(n), e1);
});
Expand Down

0 comments on commit 70a7b9a

Please sign in to comment.