From 0e53a20b235f5edd5ec98aab1c9daad48a88d46f Mon Sep 17 00:00:00 2001 From: dizzy Date: Thu, 11 Nov 2021 18:40:50 -0800 Subject: [Vue] Cannot return IAngularEvent in $emit wrapper unfortunately. (#18296) * Cannot return IAngularEvent in $emit wrapper unfortunately. * built vue files --- plugins/CoreHome/vue/dist/CoreHome.umd.js | 8 +++++--- plugins/CoreHome/vue/dist/CoreHome.umd.min.js | 4 ++-- plugins/CoreHome/vue/src/Matomo/Matomo.adapter.ts | 4 +++- plugins/CoreHome/vue/src/Matomo/Matomo.ts | 7 +++---- plugins/CoreVue/types/index.d.ts | 4 ++-- 5 files changed, 15 insertions(+), 12 deletions(-) (limited to 'plugins') diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.js b/plugins/CoreHome/vue/dist/CoreHome.umd.js index c649e0ca8b..09505f2e1d 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.js @@ -364,10 +364,10 @@ Matomo_piwik.postEvent = function postMatomoEvent(eventName) { Matomo_piwik.postEventNoEmit.apply(Matomo_piwik, [eventName].concat(args)); // required until angularjs is removed - angular.element(function () { + window.angular.element(function () { var $rootScope = Matomo_piwik.helper.getAngularDependency('$rootScope'); // eslint-disable-line - return $rootScope.$oldEmit.apply($rootScope, [eventName].concat(args)); + $rootScope.$oldEmit.apply($rootScope, [eventName].concat(args)); }); }; @@ -1206,7 +1206,9 @@ function initPiwikService(piwik, $rootScope) { args[_key - 1] = arguments[_key]; } - return Matomo_Matomo.postEvent.apply(Matomo_Matomo, [name].concat(args)); + Matomo_Matomo.postEvent.apply(Matomo_Matomo, [name].concat(args)); // can't always get the result. it's not really used in angularjs though, so it should be ok. + + return null; }; $rootScope.$oldBroadcast = $rootScope.$broadcast; // eslint-disable-line diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js index 381689e5a0..24533c5ea8 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js @@ -16,7 +16,7 @@ * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var y=window,w=y.piwik,k=y.broadcast,D=y.piwikHelper;w.helper=D,w.broadcast=k,w.updateDateInTitle=function(e,t){if($(".top_controls #periodString").length&&(u=u||document.title,0===u.indexOf(w.siteName))){var n=" - ".concat(p.parse(t,e).getPrettyString()," ");document.title="".concat(w.siteName).concat(n).concat(u.substr(w.siteName.length))}},w.hasUserCapability=function(e){return window.angular.isArray(w.userCapabilities)&&-1!==w.userCapabilities.indexOf(e)},w.on=function(e,t){function n(e){t.apply(void 0,f(e.detail))}t.wrapper=n,window.addEventListener(e,n)},w.off=function(e,t){t.wrapper&&window.removeEventListener(e,t.wrapper)},w.postEventNoEmit=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?n-1:0),a=1;a1?t-1:0),r=1;r1?n-1:0),a=1;a { + window.angular.element(() => { const $rootScope = piwik.helper.getAngularDependency('$rootScope') as any; // eslint-disable-line - return $rootScope.$oldEmit(eventName, ...args); + $rootScope.$oldEmit(eventName, ...args); }); }; diff --git a/plugins/CoreVue/types/index.d.ts b/plugins/CoreVue/types/index.d.ts index 04f0ef874d..48b04667c1 100644 --- a/plugins/CoreVue/types/index.d.ts +++ b/plugins/CoreVue/types/index.d.ts @@ -6,7 +6,7 @@ */ import jqXHR = JQuery.jqXHR; -import { IAngularEvent, IAngularStatic } from 'angular'; +import { IAngularStatic } from 'angular'; declare global { type ParameterValue = string | number | null | undefined | ParameterValue[]; @@ -120,7 +120,7 @@ declare global { on(eventName: string, listener: WrappedEventListener): void; off(eventName: string, listener: WrappedEventListener): void; - postEvent(eventName: string, ...args: any[]): IAngularEvent; + postEvent(eventName: string, ...args: any[]): void; postEventNoEmit(eventName: string, ...args: any[]): void; } -- cgit v1.2.3