Options
All
  • Public
  • Public/Protected
  • All
Menu

Module on

JMap.Event.Main.on

Here you have all JMap NG Core high level available events on which you can attach a listener.

Index

Functions

Functions

coreReady

  • coreReady(listenerId: string, fn: function): void
  • JMap.Event.Main.on.coreReady

    This event is triggered once:

    • the jmap-core library is loaded,
    • the redux store and its reducers are also loaded,
    • The initial session validation has been run. At thas point if the session has successfully been validated, the logged-in user will also be available
    example
    
    // log a message in the console once the core library is loaded
    JMap.Event.Main.on.coreReady(
      "custom-core-ready",
      () => {
        if (JMap.User.getToken() !== "-1") {
          console.log(`Logged in username is: "${JMap.User.getUsername()}"`)
        } else {
          console.log(`No user logged in`)
        }
      }
    )

    Parameters

    • listenerId: string

      Your listener id (must be unique)

    • fn: function

      Your listener function

        • (): void
        • Returns void

    Returns void

fatalError

  • fatalError(listenerId: string, fn: function): void
  • JMap.Event.Main.on.fatalError

    This event is triggered when a fatal error occurs in JMap. The event parameters will give you information about the error.

    example
    
    // log a message in the console when a fatal error occurs
    JMap.Event.Main.on.fatalError(
      "custom-core-fatal-error",
      (params) => {
         console.log(`A fatal error occured in JMap.
    
           ** Context of the error: "${params.context}";
           ** information about the error: "${params.source}";
           ** consequence of the error: "${params.action}".`
         )
      }
    )

    Parameters

    Returns void