### Notifiers

BlueGriffon provides extension developers with an object allowing to register listeners for any kind of events. This object is NotifierUtils:

#### Register a BlueGriffon event callback

Method name | `addNotifierCallback`
Parameters | `aEventName,` a string representing the event `aListener`, a function `aContext`, an object to be user in the listener as local context
Return value | no return value ; dumps an error on console if listener cannot be registered

#### Dispatch a BlueGriffon event

To dispatch an event use the following method:

Method name | `notify`
Parameters | `aEventName,` a string representing the event all other arguments will be passed to the listeners for this event
Return value | no return value ; dumps an error on console if no event of that name is registered or if a listener throws an exception

#### Remove a BlueGriffon event callback

Method name | `removeNotifierCallback`
Parameters | `aEventName,` a string representing the event `aListener`, a function
Return value | no return value ; dumps an error on console if no event of that name is registered or if that listener is not registered as callback for that event name

#### Clean all BlueGriffon event callback for a given event name

Method name | `cleanNotifier`
Parameters | `aEventName,` a string representing the event
Return value | no return value

#### Example

    var EditorScrolledNotifier =  {
      startup: function EditorScrolledNotifier_startup()
      {
        var tabeditor = document.getElementById("tabeditor");
        tabeditor.addEventListener("scroll", this.onEditorScrolled, false);
      },

      shutdown: function EditorScrolledNotifier_shutdown()
      {
        var tabeditor = document.getElementById("tabeditor");
        tabeditor.removeEventListener("scroll", this.onEditorScrolled, false);
      },

      onEditorScrolled: function EditorScrolledNotifier_onEditorScrolled(aEvent)
      {
        NotifierUtils.notify("editorScrolled", EditorUtils.getCurrentEditorElement());
      }
    };

    EditorScrolledNotifier .startup();

    .....

      <constructor>
        <![CDATA[
          NotifierUtils.addNotifierCallback("editorScrolled", this.onEditorScrolled, this);
        ]]>
      </constructor>

      <destructor>
        <![CDATA[
          NotifierUtils.removeNotifierCallback("editorScrolled", this.onEditorScrolled);
        ]]>
      </destructor>

      <method name="onEditorScrolled">
        <param name="aEditor"/>
        <body>
        <![CDATA[
          var elt = this.getSelectionForEditor(aEditor);
          this.refreshRulerForElement(elt);
        ]]>
        </body>
      </method>