Options
All
  • Public
  • Public/Protected
  • All
Menu

baconjs

Index

Type aliases

Accumulator

Accumulator<In, Out>: function

Type parameters

  • In

  • Out

Type declaration

    • (acc: Out, value: In): Out
    • Parameters

      • acc: Out
      • value: In

      Returns Out

ArrayTemplate

ArrayTemplate<A>: Array<A extends Observable<infer I> ? I : A extends Record<any, any> ? ObjectTemplate<A> : A>

Type parameters

  • A

Binder

Binder<V>: function

Binder function used in fromBinder

Type parameters

  • V

    Type of stream elements

Type declaration

CombinedTemplate

CombinedTemplate<O>: CombinedTemplate<O>

Type parameters

  • O

DecodedValueOf

DecodedValueOf<O>: FlattenedObservable<O[keyof O]>

Type parameters

  • O

DelayFunction

DelayFunction: function

Delay function used by bufferWithTime and bufferWithTimeOrCount. Your implementation should call the given void function to cause a buffer flush.

Type declaration

Differ

Differ<V, V2>: Function2<V, V, V2>

Type parameters

  • V

  • V2

Equals

Equals<A>: function

Type parameters

  • A

Type declaration

    • (left: A, right: A): boolean
    • Parameters

      • left: A
      • right: A

      Returns boolean

EventLike

EventLike<V>: V | Event<V> | Event<V>[]

Type parameters

  • V

EventOrValue

EventOrValue<V>: Event<V> | V

Type parameters

  • V

EventSink

EventSink<V>: function

Type parameters

  • V

Type declaration

EventSourceFn

EventSourceFn: function

Type declaration

    • (binder: Function, listener: Function): any
    • Parameters

      • binder: Function
      • listener: Function

      Returns any

EventSpawner

EventSpawner<V, V2>: function

Type parameters

  • V

  • V2

Type declaration

EventTransformer

EventTransformer<V>: function

Type parameters

  • V

Type declaration

FlattenedObservable

FlattenedObservable<O>: FlattenedObservable<O>

Type parameters

  • O

FlexibleSink

FlexibleSink<V>: function

Type parameters

  • V

Type declaration

Function0

Function0<R>: function

Type parameters

  • R

Type declaration

    • (): R
    • Returns R

Function1

Function1<T1, R>: function

Type parameters

  • T1

  • R

Type declaration

    • (t1: T1): R
    • Parameters

      • t1: T1

      Returns R

Function2

Function2<T1, T2, R>: function

Type parameters

  • T1

  • T2

  • R

Type declaration

    • (t1: T1, t2: T2): R
    • Parameters

      • t1: T1
      • t2: T2

      Returns R

GroupTransformer

GroupTransformer<V, V2>: function

Type parameters

  • V

  • V2

Type declaration

ObjectTemplate

ObjectTemplate<O>: object

Type parameters

  • O

Type declaration

ObservableOrSource

ObservableOrSource<V>: Observable<V> | Source<any, V>

Type parameters

  • V

Pattern

Pattern<O>: Pattern1<any, O> | Pattern2<any, any, O> | Pattern3<any, any, any, O> | Pattern4<any, any, any, any, O> | Pattern5<any, any, any, any, any, O> | Pattern6<any, any, any, any, any, any, O> | RawPattern

Join pattern type, allowing up to 6 sources per pattern.

Type parameters

  • O

Pattern1

Pattern1<I1, O>: [ObservableOrSource<I1>, O | function]

Join pattern consisting of a single EventStream and a mapping function.

Type parameters

  • I1

  • O

Pattern2

Pattern2<I1, I2, O>: [ObservableOrSource<I1>, ObservableOrSource<I1>, O | function]

Join pattern consisting of a 2 Observables and a combinator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • O

Pattern3

Pattern3<I1, I2, I3, O>: [ObservableOrSource<I1>, ObservableOrSource<I1>, ObservableOrSource<I3>, O | function]

Join pattern consisting of a 3 Observables and a combinator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • I3

  • O

Pattern4

Pattern4<I1, I2, I3, I4, O>: [ObservableOrSource<I1>, ObservableOrSource<I1>, ObservableOrSource<I3>, ObservableOrSource<I4>, O | function]

Join pattern consisting of a 4 Observables and a combinator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • I3

  • I4

  • O

Pattern5

Pattern5<I1, I2, I3, I4, I5, O>: [ObservableOrSource<I1>, ObservableOrSource<I1>, ObservableOrSource<I3>, ObservableOrSource<I4>, ObservableOrSource<I5>, O | function]

Join pattern consisting of a 5 Observables and a combinator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • I3

  • I4

  • I5

  • O

Pattern6

Pattern6<I1, I2, I3, I4, I5, I6, O>: [ObservableOrSource<I1>, ObservableOrSource<I1>, ObservableOrSource<I3>, ObservableOrSource<I4>, ObservableOrSource<I5>, ObservableOrSource<I6>, O | function]

Join pattern consisting of a 6 Observables and a combinator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • I3

  • I4

  • I5

  • I6

  • O

PollFunction

PollFunction<V>: function

A polled function used by fromPoll

Type parameters

  • V

Type declaration

Predicate

Predicate<V>: Function1<V, boolean>

Type parameters

  • V

PredicateOrProperty

PredicateOrProperty<V>: Predicate<V> | boolean | Property<boolean>

Type parameters

  • V

Reply

Reply: "<no-more>" | any

Return type for various Sink functions. Indicates whether or not the sink desires more input from its source. See Bacon.fromBinder for example.

Sink

Sink<V>: function

Type parameters

  • V

Type declaration

    • Parameters

      • value: V

      Returns Reply

SpawnerOrObservable

SpawnerOrObservable<V, V2>: ValueSpawner<V, V2> | Observable<V2>

Type parameters

  • V

  • V2

Spy

Spy: function

Type declaration

Subscribe

Subscribe<T>: function

Type parameters

  • T

Type declaration

Transformer

Transformer<V1, V2>: function

Type parameters

  • V1

  • V2

Type declaration

Unsub

Unsub: function

an "unsubscribe" function returned by subscribe et al. You can cancel your subscription by calling this function.

Type declaration

    • (): void
    • Returns void

UpdatePattern

UpdatePattern<O>: UpdatePattern1<any, O> | UpdatePattern2<any, any, O> | UpdatePattern3<any, any, any, O> | UpdatePattern4<any, any, any, any, O> | UpdatePattern5<any, any, any, any, any, O> | UpdatePattern6<any, any, any, any, any, any, O>

Update pattern type, allowing up to 6 sources per pattern.

Type parameters

  • O

UpdatePattern1

UpdatePattern1<I1, O>: [Observable<I1>, O | function]

Update pattern consisting of a single EventStream and a accumulator function.

Type parameters

  • I1

  • O

UpdatePattern2

UpdatePattern2<I1, I2, O>: [Observable<I1>, Observable<I1>, O | function]

Update pattern consisting of 2 Observables and an accumulrator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • O

UpdatePattern3

UpdatePattern3<I1, I2, I3, O>: [Observable<I1>, Observable<I1>, Observable<I3>, O | function]

Update pattern consisting of 3 Observables and an accumulrator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • I3

  • O

UpdatePattern4

UpdatePattern4<I1, I2, I3, I4, O>: [Observable<I1>, Observable<I1>, Observable<I3>, Observable<I4>, O | function]

Update pattern consisting of 4 Observables and an accumulrator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • I3

  • I4

  • O

UpdatePattern5

UpdatePattern5<I1, I2, I3, I4, I5, O>: [Observable<I1>, Observable<I1>, Observable<I3>, Observable<I4>, Observable<I5>, O | function]

Update pattern consisting of 5 Observables and an accumulrator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • I3

  • I4

  • I5

  • O

UpdatePattern6

UpdatePattern6<I1, I2, I3, I4, I5, I6, O>: [Observable<I1>, Observable<I1>, Observable<I3>, Observable<I4>, Observable<I5>, Observable<I6>, O | function]

Update pattern consisting of 6 Observables and an accumulrator function. At least one of the Observables must be an EventStream.

Type parameters

  • I1

  • I2

  • I3

  • I4

  • I5

  • I6

  • O

ValueSpawner

ValueSpawner<V, V2>: function

Type parameters

  • V

  • V2

Type declaration

VoidFunction

VoidFunction: function

Type declaration

    • (): void
    • Returns void

VoidSink

VoidSink: function

Type declaration

Variables

Const more

more: Reply = undefined

Reply for "more data, please".

Const noMore

noMore: Reply = "<no-more>"

Reply for "no more data, please".

Const version

version: "<version>" = "<version>"

Bacon.js version as string

Functions

combineAsArray

  • Combines Properties, EventStreams and constant values so that the result Property will have an array of the latest values from all sources as its value. The inputs may contain both Properties and EventStreams.

    property = Bacon.constant(1)
    stream = Bacon.once(2)
    constant = 3
    Bacon.combineAsArray(property, stream, constant)
    # produces the value [1,2,3]

    Type parameters

    • V

    Parameters

    Returns Property<V[]>

combineTemplate

combineWith

  • Combines given n Properties, EventStreams and constant values using the given n-ary function f(v1, v2 ...).

    To calculate the current sum of three numeric Properties, you can do

    function sum3(x,y,z) { return x + y + z }
    Bacon.combineWith(sum3, p1, p2, p3)

    Type parameters

    • Out

    Parameters

    • f: function
        • (...args: any[]): Out
        • Parameters

          • Rest ...args: any[]

          Returns Out

    • Rest ...streams: Observable<any>[]

    Returns Property<Out>

concatAll

  • Concatenates given array of EventStreams or Properties. Works by subcribing to the first source, and listeing to that until it ends. Then repeatedly subscribes to the next source, until all sources have ended.

    See concat

    Type parameters

    • V

    Parameters

    Returns EventStream<V>

constant

  • Creates a constant property with value x.

    Type parameters

    • V

    Parameters

    • x: V

    Returns Property<V>

fromArray

  • Creates an EventStream that delivers the given series of values (given as array) to the first subscriber. The stream ends after these values have been delivered. You can also send Bacon.Error events, or any combination of pure values and error events like this: `Bacon.fromArray([1, new Bacon.Error()])

    typeparam

    Type of stream elements

    Type parameters

    • T

    Parameters

    • values: (T | Event<T>)[]

      Array of values or events to repeat

    Returns EventStream<T>

fromBinder

  • If none of the other factory methods above apply, you may of course roll your own EventStream by using fromBinder.

    Bacon.fromBinder(subscribe) The parameter subscribe is a function that accepts a sink which is a function that your subscribe function can "push" events to.

    For example:

    var stream = Bacon.fromBinder(function(sink) {
    sink("first value")
    sink([new Bacon.Next("2nd"), new Bacon.Next("3rd")])
    sink(new Bacon.Error("oops, an error"))
    sink(new Bacon.End())
    return function() {
    // unsub functionality here, this one's a no-op
    }
    })
    stream.log()

    As shown in the example, you can push

    • A plain value, like "first value"
    • An Event object including Bacon.Error (wraps an error) and Bacon.End (indicates stream end).
    • An array of event objects at once

    Other examples can be found on JSFiddle and the Bacon.js blog.

    The subscribe function must return a function. Let's call that function unsubscribe. The returned function can be used by the subscriber (directly or indirectly) to unsubscribe from the EventStream. It should release all resources that the subscribe function reserved.

    The sink function may return Bacon.noMore (as well as Bacon.more or any other value). If it returns Bacon.noMore, no further events will be consumed by the subscriber. The subscribe function may choose to clean up all resources at this point (e.g., by calling unsubscribe). This is usually not necessary, because further calls to sink are ignored, but doing so can increase performance in rare cases.

    The EventStream will wrap your subscribe function so that it will only be called when the first stream listener is added, and the unsubscribe function is called only after the last listener has been removed. The subscribe-unsubscribe cycle may of course be repeated indefinitely, so prepare for multiple calls to the subscribe function.

    Type parameters

    • V

      Type of stream elements

    Parameters

    Returns EventStream<V>

fromCallback

  • fromCallback<V>(f: Function, ...args: any[]): EventStream<V>
  • Creates an EventStream from a function that accepts a callback. The function is supposed to call its callback just once. For example:

    Bacon.fromCallback(callback => callback("bacon"))

    This would create a stream that outputs a single value "Bacon!" and ends after that. The use of setTimeout causes the value to be delayed by 1 second.

    You can also give any number of arguments to fromCallback, which will be passed to the function. These arguments can be simple variables, Bacon EventStreams or Properties. For example the following will output "Bacon rules":

    bacon = Bacon.constant('bacon')
    Bacon.fromCallback(function(a, b, callback) {
    callback(a + ' ' + b);
    }, bacon, 'rules').log();

    Type parameters

    • V

    Parameters

    • f: Function
    • Rest ...args: any[]

    Returns EventStream<V>

fromESObservable

  • fromESObservable<V>(_observable: any): EventStream<V>

fromEvent

  • creates an EventStream from events on a DOM EventTarget or Node.JS EventEmitter object, or an object that supports event listeners using on/off methods. You can also pass an optional function that transforms the emitted events' parameters.

    The simple form:

    Bacon.fromEvent(document.body, "click").onValue(function() { alert("Bacon!") })

    Using a binder function:

    Bacon.fromEvent(
    window,
    function(binder, listener) {
    binder("scroll", listener, {passive: true})
    }
    ).onValue(function() {
    console.log(window.scrollY)
    })

    Type parameters

    • V

      Type of stream elements

    Parameters

    Returns EventStream<V>

fromNodeCallback

  • fromNodeCallback<V>(f: Function, ...args: any[]): EventStream<V>
  • Behaves the same way as Bacon.fromCallback, except that it expects the callback to be called in the Node.js convention: callback(error, data), where error is null if everything is fine. For example:

    var Bacon = require('baconjs').Bacon,
    fs = require('fs');
    var read = Bacon.fromNodeCallback(fs.readFile, 'input.txt');
    read.onError(function(error) { console.log("Reading failed: " + error); });
    read.onValue(function(value) { console.log("Read contents: " + value); });

    Type parameters

    • V

    Parameters

    • f: Function
    • Rest ...args: any[]

    Returns EventStream<V>

fromPoll

  • Polls given function with given interval. Function should return Events: either Bacon.Next or Bacon.End. Polling occurs only when there are subscribers to the stream. Polling ends permanently when f returns Bacon.End.

    Type parameters

    • V

      Type of stream elements

    Parameters

    • delay: number

      poll interval in milliseconds

    • poll: PollFunction<V>

      function to be polled

    Returns EventStream<V>

fromPromise

  • Creates an EventStream from a Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end. You can use the optional abort flag (i.e. ´fromPromise(p, true)´ to have the abort method of the given promise be called when all subscribers have been removed from the created stream. You can also pass an optional function that transforms the promise value into Events. The default is to transform the value into [new Bacon.Next(value), new Bacon.End()]. Check out this example.

    Type parameters

    • V

    Parameters

    • promise: Promise<V>
    • Optional abort: undefined | false | true

      should we call the abort method of the Promise on unsubscribe. This is a nonstandard feature you should probably ignore.

    • Default value eventTransformer: EventTransformer<V> = valueAndEnd

    Returns EventStream<V>

getScheduler

hasValue

  • hasValue<V>(e: Event<V>): boolean

interval

  • Repeats the single element indefinitely with the given interval (in milliseconds)

    Type parameters

    • V

      Type of stream elements

    Parameters

    • delay: number

      Repeat delay in milliseconds

    • value: V

      The single value to repeat

    Returns EventStream<V>

isEnd

  • isEnd<V>(e: Event<V>): boolean
  • Returns true if the given event is an End

    Type parameters

    • V

    Parameters

    Returns boolean

isError

  • isError<V>(e: Event<V>): boolean

isEvent

  • isEvent<V>(e: any): boolean
  • Returns true if the given object is an Event.

    Type parameters

    • V

    Parameters

    • e: any

    Returns boolean

isInitial

  • isInitial<V>(e: any): boolean
  • Returns true if the given event is an Initial value of a Property.

    Type parameters

    • V

    Parameters

    • e: any

    Returns boolean

isNext

  • isNext<V>(e: Event<V>): boolean
  • Returns true if the given event is a Next

    Type parameters

    • V

    Parameters

    Returns boolean

later

  • Creates a single-element stream that emits given value after given delay and ends.

    Type parameters

    • V

      Type of stream elements

    Parameters

    • delay: number

      delay in milliseconds

    • value: V

      value to be emitted

    Returns EventStream<V>

mergeAll

  • Merges given array of EventStreams or Properties, by collecting the values from all of the sources into a single EventStream.

    See also merge.

    Type parameters

    • V

    Parameters

    Returns EventStream<V>

never

  • Creates an EventStream that immediately ends.

    Type parameters

    • V

      Type of stream elements

    Returns EventStream<V>

onValues

  • onValues(...args: any[]): Unsub
  • A shorthand for combining multiple sources (streams, properties, constants) as array and assigning the side-effect function f for the values. The following example would log the number 3.

    function f(a, b) { console.log(a + b) }
    Bacon.onValues(Bacon.constant(1), Bacon.constant(2), f)

    Parameters

    • Rest ...args: any[]

    Returns Unsub

once

  • Creates an EventStream that delivers the given single value for the first subscriber. The stream will end immediately after this value. You can also send an Bacon.Error event instead of a value: Bacon.once(new Bacon.Error("fail")).

    Type parameters

    • V

      Type of stream elements

    Parameters

    • value: V | Event<V>

      the value or event to emit

    Returns EventStream<V>

repeat

  • Calls generator function which is expected to return an observable. The returned EventStream contains values and errors from the spawned observable. When the spawned observable ends, the generator is called again to spawn a new observable.

    This is repeated until the generator returns a falsy value (such as undefined or false).

    The generator function is called with one argument — iteration number starting from 0.

    Here's an example:

    Bacon.repeat(function(i) {
    if (i < 3) {
    return Bacon.once(i);
    } else {
    return false;
    }
    }).log()

    The example will produce values 0, 1 and 2.

    Type parameters

    • V

      Type of stream elements

    Parameters

    • generator: function
        • Parameters

          • iteration: number

          Returns undefined | Observable<V>

    Returns EventStream<V>

repeatedly

  • Repeats given elements indefinitely with given interval in milliseconds. For example, repeatedly(10, [1,2,3]) would lead to 1,2,3,1,2,3... to be repeated indefinitely.

    Type parameters

    • V

      Type of stream elements

    Parameters

    • delay: number

      between values, in milliseconds

    • values: (V | Event<V>)[]

      array of values to repeat

    Returns EventStream<V>

retry

  • Used to retry the call when there is an Error event in the stream produced by the source function.

    var triggeringStream, ajaxCall // <- ajaxCall gives Errors on network or server errors
    ajaxResult = triggeringStream.flatMap(function(url) {
    return Bacon.retry({
    source: function(attemptNumber) { return ajaxCall(url) },
    retries: 5,
    isRetryable: function (error) { return error.httpStatusCode !== 404; },
    delay: function(context) { return 100; } // Just use the same delay always
    })
    })

    Type parameters

    • V

    Parameters

    Returns EventStream<V>

sequentially

  • Creates a stream containing given values (given as array). Delivered with given interval in milliseconds.

    Type parameters

    • V

      Type of stream elements

    Parameters

    • delay: number

      between elements, in milliseconds

    • values: (V | Event<V>)[]

    Returns EventStream<V>

setScheduler

  • setScheduler(newScheduler: Scheduler): void

silence

  • Creates a stream that ends after given amount of milliseconds, without emitting any values.

    Type parameters

    • V

      Type of stream elements

    Parameters

    • duration: number

      duration of silence in milliseconds

    Returns EventStream<V>

Const spy

  • spy(spy: Spy): number
  • Adds your function as a "spy" that will get notified on all new Observables. This will allow a visualization/analytics tool to spy on all Bacon activity.

    Parameters

    Returns number

symbol

  • symbol(key: string): any
  • Parameters

    • key: string

    Returns any

update

  • Creates a Property from an initial value and updates the value based on multiple inputs. The inputs are defined similarly to Bacon.when, like this:

    var result = Bacon.update(
    initial,
    [x,y,z, (previous,x,y,z) => { ... }],
    [x,y,   (previous,x,y) => { ... }])

    As input, each function above will get the previous value of the result Property, along with values from the listed Observables. The value returned by the function will be used as the next value of result.

    Just like in Bacon.when, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream.

    Here's a simple gaming example:

    let scoreMultiplier = Bacon.constant(1)
    let hitUfo = Bacon.interval(1000)
    let hitMotherShip = Bacon.later(10000)
    let score = Bacon.update(
    0,
    [hitUfo, scoreMultiplier, (score, _, multiplier) => score + 100 * multiplier ],
    [hitMotherShip, (score, _) => score + 2000 ]
    )

    In the example, the score property is updated when either hitUfo or hitMotherShip occur. The scoreMultiplier Property is sampled to take multiplier into account when hitUfo occurs.

    Type parameters

    • Out

    Parameters

    Returns Property<Out>

when

  • The when method provides a generalization of the zip function. While zip synchronizes events from multiple streams pairwse, the join patterns used in when allow the implementation of more advanced synchronization patterns.

    Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick.

    Bacon.when(
    [tick, keyEvent, function(_, k) { handleKeyEvent(k); return handleTick(); }],
    [tick, handleTick])

    Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick.

    Join patterns are indeed a generalization of zip, and for EventStreams, zip is equivalent to a single-rule join pattern. The following observables have the same output, assuming that all sources are EventStreams.

    Bacon.zipWith(a,b,c, combine)
    Bacon.when([a,b,c], combine)

    Note that Bacon.when does not trigger updates for events from Properties though; if you use a Property in your pattern, its value will be just sampled when all the other sources (EventStreams) have a value. This is useful when you need a value of a Property in your calculations. If you want your pattern to fire for a Property too, you can convert it into an EventStream using property.changes() or property.toEventStream()

    Type parameters

    • O

      result type

    Parameters

    • Rest ...patterns: Pattern<O>[]

      Join patterns

    Returns EventStream<O>

withStateMachineT

  • withStateMachineT<In, State, Out>(initState: State, f: StateF<In, State, Out>): Transformer<In, Out>

zipAsArray

  • Zips the array of EventStreams / Properties in to a new EventStream that will have an array of values from each source as its value. Zipping means that events from each source are combined pairwise so that the 1st event from each source is published first, then the 2nd event from each. The results will be published as soon as there is a value from each source.

    Be careful not to have too much "drift" between streams. If one stream produces many more values than some other excessive buffering will occur inside the zipped observable.

    Example:

    x = Bacon.fromArray([1,2,3])
    y = Bacon.fromArray([10, 20, 30])
    z = Bacon.fromArray([100, 200, 300])
    Bacon.zipAsArray(x, y, z)
    
    # produces values [1, 10, 100], [2, 20, 200] and [3, 30, 300]

    Type parameters

    • V

    Parameters

    Returns Observable<V[]>

zipWith

  • Like zipAsArray but uses the given n-ary function to combine the n values from n sources, instead of returning them in an Array.

    Type parameters

    • Out

    Parameters

    • f: function
        • (...any: any[]): Out
        • Parameters

          • Rest ...any: any[]

          Returns Out

    • Rest ...streams: Observable<any>[]

    Returns EventStream<Out>

Object literals

Const $

$: object

JQuery/Zepto integration support

asEventStream

  • asEventStream(eventName: string, selector: string | undefined, eventTransformer: any): EventStream<any>
  • Creates an EventStream from events on a jQuery or Zepto.js object. You can pass optional arguments to add a jQuery live selector and/or a function that processes the jQuery event and its parameters, if given, like this:

    $("#my-div").asEventStream("click", ".more-specific-selector")
    $("#my-div").asEventStream("click", ".more-specific-selector", function(event, args) { return args[0] })
    $("#my-div").asEventStream("click", function(event, args) { return args[0] })

    Note: you need to install the asEventStream method on JQuery by calling init() as in Bacon.$.init($).

    Parameters

    • eventName: string
    • selector: string | undefined
    • eventTransformer: any

    Returns EventStream<any>

init

  • init(jQuery: any): void
  • Installs the asEventStream to the given jQuery/Zepto object (the $ object).

    Parameters

    • jQuery: any

    Returns void

Generated using TypeDoc