FCF 2.0 development in progress...
> > > > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

onmet() method from fcf.EventChannel class

onmet(staring a_eventName, function a_callback)
onmet(staring a_eventName, object a_options, function a_callback)

Package: fcf-framework-core

File: fcf-framework-core:fcf.js

Available from version: 2.0.2

Adds an event handler that is called only for the first call to the event. If the event has already been called before adding the handler, then the event handler is called with the event data that was passed in the previous call.

Arguments

string a_eventName
- Event name

object a_options
- Object with additional options
  • number level = 0 - The callback processing order level. The order in which handlers are called is from lowest to highest level.

function a_callback
- The callback handler function.

Function signature: (async or simple) a_callback(object a_eventData, object a_eventHeader)

  • object a_eventData - The event data that was passed to the send function

  • object a_eventHeader - Event header

    Object properties:

    • string name - Event name

Example:

fcf.getEventChannel().onmet("test_event", (a_eventData, a_eventHeader)=>{ console.log("Event data: ", a_eventData); console.log("Event header:", a_eventHeader); }); fcf.getEventChannel().send("test_event", {field1: "value1"});