AE JS Events Reference Table Test

Updated 3 months ago ​by Annabel Youens

You can optionally define and set up event handlers through the event addHandler method. This article provides a reference of the available events.

As an example of usage, here is some JavaScript that calls some events:

<script>
  //locally defined handlers
  function loginHandler(user) {
    console.log("LOGIN HANDLER");
    console.log(user);
  }

  function AEJSReady(aeJS) {
    //attach local handlers to events
    aeJS.events.onFlow.addHandler(flowHandler);
    aeJS.events.onLogin.addHandler(loginHandler);
    aeJS.events.onWindow.addHandler(windowHandler);
  }
</script>

Note that this article refers back to AE JS Settings and AE JS Methods.

Event is triggered at successful completion of the trigger.send_activity method. See the AE JS Methods Reference for more information.

response: Associated data structure for response from send_activity call. Either OK, a new activity record, or an error.


Event is triggered at different steps of custom email verification.

sent: Triggered initiated via a successful call to trigger.send_verify_email. Returns sent or verified. For example: {'EmailAddress', 'ActivationCode'} 

verified: Triggered on the callback page defined in trigger.send_verify_email or the default return_url in settings. Returns the associated data structure for the step. For example: {'MemberID', 'MemberServiceID', 'EmailAddress', 'ActivationCode', 'Service'}

 

Event is triggered at each distinct step of registration flow.

step: is an object containing information on current step in flow and associated data. 

Example:

{step: "login", auth_url: "http://beta.theappreciationengine.com/framework/flow/422/login", return: "http://squared99.com/new_framework2.html#", service: "twitter"}


Event is triggered on successful login.

user: object containing profile information on currently logged in user. 

type: login or registration. If returning from login, flow will be login. If returning from registration, flow will be registration. The default value is login.

sso: Boolean value indicated whether onLogin event fired due to single sign-on event. The existing user that had previously signed on with framework.

Example user: 

{"data": {"firstname": "Jeff","surname": "Mitchell","email": "XX","gender": "M","age": "39","id": 7,"avatarurl": "http://theappreciationengine.com/Member_Controller/getAvatar/7","country": null,"city": null,"countrycode": null},"services": [{"service": "twitter","valid": "1","id": "4374025","userid": "36905641","username": "squared99","userurl": "http://twitter.com/squared99","token":"XX","tokensecret": "XX","lastupdated": null,"verifiedemail": null,"paidaccount": "0","followers": "0","likes": "0"}]},


Event is triggered after all initialization and required preparation calls have been made by AE JS. This differs from the AEJSReady call, which is triggered upon successful script load. The onLoadedevent handler must be defined within the AEJSReady function.

aeJS: An object that contains the framework reference in its current state.


An event triggered at successful completion of trigger.optin.

reponse: Associated data structure for response from optin call. Either OK, a user record, or an error.



An event triggered after trigger.reset_password is called.

status: Returns ok or error

message: If the status is error, this is associated message.



Event is triggered if user session exists on page load.

user : An object containing profile information on currently logged in user. 

state: Returns init or update. It will always return initif member session is active on page load. update is fired in cases where the member record has been updated, such as in the case of a custom form submission with the data-ae-register-formattribute.

Example user: 

{"data": {"firstname": "Jeff","surname": "Mitchell","email": "XX","gender": "M","age": "39","id": 7,"avatarurl": "http://theappreciationengine.com/Member_Controller/getAvatar/7","country": null,"city": null,"countrycode": null},"services": [{"service": "twitter","valid": "1","id": "4374025","userid": "36905641","username": "squared99","userurl": "http://twitter.com/squared99","token":"XX","tokensecret": "XX","lastupdated": null,"verifiedemail": null,"paidaccount": "0","followers": "0","likes": "0"}]},


An event is triggered on successful logout.

null

This event is triggered on removal of service through data-ae-remove-link or aeJS.trigger.remove.

service: String for the service removed. For example: facebook

user: An object containing profile information on currently logged in user.

This event is triggered at close and open of modal windows.

state: An object containing type (popup or modal) and the current state (open or closed) of window.

Example:

{type: "popup", state: "opened", service: "twitter"}"


This event is triggered if current browser session is determined to be from a tablet or mobile device.

null

Event

Parameters

Description

aeJS.events.onActivitySent

response

Event is triggered at successful completion of trigger.send_activity

parameters:

response: associated data structure for response from send_activity call. Either OK, new activity record or an error.

aeJS.events.onEmailVerify

step,data

Event is triggered at different steps of custom email verification.

‘sent’ is triggered initiated via a successful call to trigger.send_verify_email.

‘verified’ is triggered on the callback page defined in trigger.send_verify_email or the default return_url in settings.

parameters:

step: ‘sent’ or ‘verified’.

data: associated data structure for step.

sent: {'EmailAddress','ActivationCode'}

verified : {'MemberID','MemberServiceID', 'EmailAddress','ActivationCode','Service'}

aeJS.events.onFlow

step

Event is triggered at each distinct step of registration flow.

parameter:

step: object containing information on current step in flow and associated data.

Example:  

{step: "login", auth_url: "http://beta.theappreciationengine.com/framework/flow/422/login", return: "http://squared99.com/new_framework2.html#", service: "twitter"}

aeJS.events.onLogin

user,type,sso

Event is triggered on successful login.

parameters:

user: object containing profile information on currently logged in user.

type: ‘login’ or ‘registration’. If returning from login, flow will be ‘login’. If returning from registration, flow will be ‘registration’ (default ‘login’)

sso: boolean value indicated whether onLogin event fired due to single sign-on event. i.e existing user that previously signed on with framework.

Example user:

{"data": {"firstname": "Jeff","surname": "Mitchell","email": "XX","gender": "M","age": "39","id": 7,"avatarurl": "http://theappreciationengine.com/Member_Controller/getAvatar/7","country": null,"city": null,"countrycode": null},"services": [{"service": "twitter","valid": "1","id": "4374025","userid": "36905641","username": "squared99","userurl": "http://twitter.com/squared99","token":"XX","tokensecret": "XX","lastupdated": null,"verifiedemail": null,"paidaccount": "0","followers": "0","likes": "0"}]},

aeJS.events.onLoaded

aeJS

Event is triggered after all initialization and required preparation calls have been made by aeJS. This differs from the AEJSReady call which is triggered upon successful script load. The onLoaded event handler must be defined within the AEJSReady function.

parameters:

aejS: object that contains the framework reference in its current state.

aeJS.events.onOptin

response

Event is triggered at successful completion of trigger.optin

parameters:

response: associated data structure for response from optin call. Either OK, user record or an error.

aeJS.events.onPasswordReset

status, message

Event is triggered after trigger.reset_password is called.

parameters:

status: ‘ok’ or ‘error’.

message: if status is ‘error’, this is associated message.

aeJS.events.onUser

user,state

Event is triggered if user session exists on page load.

parameters:

user: object containing profile information on currently logged in user.

state: ‘init’ or ‘update’. Will always be ‘init’ if member session is active on page load, ‘init’ is fired in cases where the member record has been updated, such as in the case of a custom form submission with the data-ae-register-form attribute.

Example user:

{"data": {"firstname": "Jeff","surname": "Mitchell","email": "XX","gender": "M","age": "39","id": 7,"avatarurl": "http://theappreciationengine.com/Member_Controller/getAvatar/7","country": null,"city": null,"countrycode": null},"services": [{"service": "twitter","valid": "1","id": "4374025","userid": "36905641","username": "squared99","userurl": "http://twitter.com/squared99","token":"XX","tokensecret": "XX","lastupdated": null,"verifiedemail": null,"paidaccount": "0","followers": "0","likes": "0"}]},

aeJS.events.onLogout

null

Event is triggered on successful logout.

aeJS.events.onServiceRemoved

service,user

Event is triggered on removal of service through data-ae-remove-link or aeJS.trigger.remove

parameters:

service:string for the service removed, eg ‘facebook’.

user: object containing profile information on currently logged in user.

aeJS.events.onWindow

state

Event is triggered at close and open of modal windows.

parameter:

state: object containing ‘type’ and current ‘state’ of window. type: ‘popup’ or ‘modal’

state: ‘opened’ or ‘closed’

Example:

{type: "popup", state: "opened", service: "twitter"}

aeJS.events.onMobileDetect

null

Event is triggered if current browser session is determined to be via mobile or tablet.

 


How did we do?