Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordizzy <diosmosis@users.noreply.github.com>2021-11-12 05:40:50 +0300
committerGitHub <noreply@github.com>2021-11-12 05:40:50 +0300
commit0e53a20b235f5edd5ec98aab1c9daad48a88d46f (patch)
tree6f7f6a7ce1f2f6ece044907c71581fa89db65382
parent1e4af959702fb184001db899bfb6ac5f8c12c85a (diff)
[Vue] Cannot return IAngularEvent in $emit wrapper unfortunately. (#18296)
* Cannot return IAngularEvent in $emit wrapper unfortunately. * built vue files
-rw-r--r--plugins/CoreHome/vue/dist/CoreHome.umd.js8
-rw-r--r--plugins/CoreHome/vue/dist/CoreHome.umd.min.js4
-rw-r--r--plugins/CoreHome/vue/src/Matomo/Matomo.adapter.ts4
-rw-r--r--plugins/CoreHome/vue/src/Matomo/Matomo.ts7
-rw-r--r--plugins/CoreVue/types/index.d.ts4
5 files changed, 15 insertions, 12 deletions
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;r<t;r++)n[r-1]=arguments[r];var a=new CustomEvent(e,{detail:n});window.dispatchEvent(a)},w.postEvent=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];w.postEventNoEmit.apply(w,[e].concat(n)),angular.element((function(){var t=w.helper.getAngularDependency("$rootScope");return t.$oldEmit.apply(t,[e].concat(n))}))};var O=w,j=O;
+ */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;r<t;r++)n[r-1]=arguments[r];var a=new CustomEvent(e,{detail:n});window.dispatchEvent(a)},w.postEvent=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];w.postEventNoEmit.apply(w,[e].concat(n)),window.angular.element((function(){var t=w.helper.getAngularDependency("$rootScope");t.$oldEmit.apply(t,[e].concat(n))}))};var O=w,j=O;
/*!
* Matomo - free/libre analytics platform
*
@@ -93,7 +93,7 @@ function De(){var e={getSearchParam:ke.getSearchParam.bind(ke)};return e}
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-function Oe(){return j}function je(e,t){t.$oldEmit=t.$emit,t.$emit=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return j.postEvent.apply(j,[e].concat(n))},t.$oldBroadcast=t.$broadcast,t.$broadcast=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return j.postEventNoEmit.apply(j,[e].concat(r)),t.$oldBroadcast.apply(t,[e].concat(r))},t.$on("$locationChangeSuccess",e.updatePeriodParamsFromUrl)}function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach((function(t){xe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Te(e,t,n){return t&&Ee(e.prototype,t),n&&Ee(e,n),e}function xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
+function Oe(){return j}function je(e,t){t.$oldEmit=t.$emit,t.$emit=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return j.postEvent.apply(j,[e].concat(n)),null},t.$oldBroadcast=t.$broadcast,t.$broadcast=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return j.postEventNoEmit.apply(j,[e].concat(r)),t.$oldBroadcast.apply(t,[e].concat(r))},t.$on("$locationChangeSuccess",e.updatePeriodParamsFromUrl)}function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach((function(t){xe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Te(e,t,n){return t&&Ee(e.prototype,t),n&&Ee(e,n),e}function xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/*!
* Matomo - free/libre analytics platform
*
diff --git a/plugins/CoreHome/vue/src/Matomo/Matomo.adapter.ts b/plugins/CoreHome/vue/src/Matomo/Matomo.adapter.ts
index 8ea591fca7..0ab71e38ef 100644
--- a/plugins/CoreHome/vue/src/Matomo/Matomo.adapter.ts
+++ b/plugins/CoreHome/vue/src/Matomo/Matomo.adapter.ts
@@ -18,7 +18,9 @@ function initPiwikService(piwik: PiwikGlobal, $rootScope: IRootScopeService) {
// overwrite $rootScope so all events also go through Matomo.postEvent(...) too.
($rootScope as any).$oldEmit = $rootScope.$emit; // eslint-disable-line
$rootScope.$emit = function emitWrapper(name: string, ...args: any[]): IAngularEvent { // eslint-disable-line
- return Matomo.postEvent(name, ...args);
+ Matomo.postEvent(name, ...args);
+ // can't always get the result. it's not really used in angularjs though, so it should be ok.
+ return null as unknown as IAngularEvent;
};
($rootScope as any).$oldBroadcast = $rootScope.$broadcast; // eslint-disable-line
diff --git a/plugins/CoreHome/vue/src/Matomo/Matomo.ts b/plugins/CoreHome/vue/src/Matomo/Matomo.ts
index e2a00bc3b1..30b821f403 100644
--- a/plugins/CoreHome/vue/src/Matomo/Matomo.ts
+++ b/plugins/CoreHome/vue/src/Matomo/Matomo.ts
@@ -5,7 +5,6 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-import { IAngularEvent } from 'angular';
import Periods from '../Periods/Periods';
let originalTitle: string;
@@ -61,13 +60,13 @@ piwik.postEventNoEmit = function postEventNoEmit(
piwik.postEvent = function postMatomoEvent(
eventName: string,
...args: any[] // eslint-disable-line
-): IAngularEvent {
+): void {
piwik.postEventNoEmit(eventName, ...args);
// required until angularjs is removed
- angular.element(() => {
+ 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;
}