From d20195b5e7c2da5c7f84c6116d2be6f55d62d6fa Mon Sep 17 00:00:00 2001 From: Carlos Zumbado Date: Wed, 16 Feb 2022 15:59:21 -0600 Subject: [PATCH] RAFX multiple listeners on same event. Allowing RAFX to have more than one listener by switching to arrays instead of single values. --- advertising/rsgemt/lib/rafxssai.brs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/advertising/rsgemt/lib/rafxssai.brs b/advertising/rsgemt/lib/rafxssai.brs index da8e842..d2f57b5 100644 --- a/advertising/rsgemt/lib/rafxssai.brs +++ b/advertising/rsgemt/lib/rafxssai.brs @@ -49,12 +49,18 @@ return obj end function evtcll = {} evtcll.addEventListener = function(event as string, callback as function) as Void -m.callbacks[event] = callback +if m.callbacks[event] = invalid +m.callbacks[event] = [callback] +else +m.callbacks[event].push(callback) +end if end function evtcll.doCall = function(event as string, adInfo as object) as Void if invalid <> m.callbacks[event] func = getglobalaa()["callFunctionInGlobalNamespace"] -func(m.callbacks[event], adInfo) +for each item in m.callbacks[event] +func(item, adInfo) +end for end if end function evtcll.errCall = function(errid as integer, errInfo as string) as Void