API Docs for: 0.0.6

Class Protobone.Base

Class defined in: src/Base.js:1

Base class for Protobone classes. Shared functions which are needed in all classes. This class is not meant to be instantiated by itself.

Protobone.Base( )
src/Base.js:1
Boolean fireEvent( eventName )
src/Base.js:60

Fires an event, informing all listneners that are registered for the given event name. The fireEvent function can be called with any number of additional arguments, which are then passed to the event handler function.

Returns true if NONE of the registered handlers return false: As soon as one listener returns false, fireEvent will also return false.

Parameters:
  • eventName <String>

    The event to fire, e.g. 'updated'


Returns: <Boolean>

true when non of the listeners returned false, false if they do so.

off( eventName, callback, this )
src/Base.js:34

Removes a specific event handler for an event, or removes all listerners from an event.

Parameters:
  • eventName <String>

    E.g. 'updated'

  • callback <Function>

    The callback to remove. If omitted, all callbacks for a specific event are removed

  • this <Boolean>
on( eventName, callback, this )
src/Base.js:16

Registers an event handler. It does not check on duplicity, so you can add the same event handler multiple times.

Parameters:
  • eventName <String>

    The name of the event, e.g. 'updated'

  • callback <Function>

    The listener function, called with event-specific {parameters}

  • this <Boolean>