Class: kb.EventWatcher

Defined in: src/core/event-watcher.coffee

Overview

Used to provide a central place to aggregate registered Model events rather than having all kb.Observables register for updates independently.

Class Method Summary

Instance Method Summary

Class Method Details

. (void) useOptionsOrCreate(options, emitter, obj, callback_options)

Used to either register yourself with the existing emitter watcher or to create a new one.

Parameters:

  • options ( Object ) please pass the options from your constructor to the register method. For example, constructor(emitter, options)
  • obj ( Model|ModelRef ) the Model that will own or register with the store
  • emitter ( ko.observable|Object ) the emitters of the event watcher
  • callback_options ( Object ) information about the event and callback to register

Options Hash: (options):

  • emitter ( Function ) callback for when the emitter changes (eg. is loaded). Signature: function(new_emitter)
  • update ( Function ) callback for when the registered event is triggered. Signature: function(new_value)
  • event_selector ( String ) the name or names of events.
  • key ( String ) the optional key to filter update attribute events.

Constructor Details

# (void) constructor(emitter, obj, callback_options)

Instance Method Details

# (void) destroy()

Required clean up function to break cycles, release view emitters, etc. Can be called directly, via kb.release(object) or as a consequence of ko.releaseNode(element).

~ (Model|ModelRef) emitter()
~ (void) emitter(new_emitter)

Dual-purpose getter/setter for the observed emitter.

Overloads:

~ (Model|ModelRef) emitter()

Gets the emitter or emitter reference

Returns:

  • ( Model|ModelRef ) — the emitter whose attributes are being observed (can be null)

~ (void) emitter(new_emitter)

Sets the emitter or emitter reference

Parameters:

  • new_emitter ( Model|ModelRef ) the emitter whose attributes will be observed (can be null)

# (void) registerCallbacks(obj, callback_info)

Used to register callbacks for an emitter.

Parameters:

  • obj ( Object ) the owning object.
  • callback_info ( Object ) the callback information

Options Hash: (options):

  • emitter ( Function ) callback for when the emitter changes (eg. is loaded). Signature: function(new_emitter)
  • update ( Function ) callback for when the registered emitter is triggered. Signature: function(new_value)
  • emitter_name ( String ) the name of the emitter.
  • key ( String ) the optional key to filter update attribute events.

# (void) releaseCallbacks(obj)

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: