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
path: root/js
diff options
context:
space:
mode:
authorAnthon Pang <apang@softwaredevelopment.ca>2013-03-24 02:39:48 +0400
committerAnthon Pang <apang@softwaredevelopment.ca>2013-03-24 08:53:48 +0400
commit2eed2eb680ebe191c883bf3cb0dd63a08752efcf (patch)
treefab88ec7d6700d25db0a3662e3d43dcc0c7b7732 /js
parente233ebaa002ccc20590e7f1ea4247189a873a665 (diff)
fixes #3352 - expose Piwik as an AMD module (uses the jQuery approach for backward compatibility)
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js24
1 files changed, 18 insertions, 6 deletions
diff --git a/js/piwik.js b/js/piwik.js
index 6472f9d1fb..b4314af10b 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -383,7 +383,6 @@ if (!this.JSON2) {
/*global unescape */
/*global ActiveXObject */
/*global _paq:true */
-/*global Piwik_Overlay_Client */
/*members encodeURIComponent, decodeURIComponent, getElementsByTagName,
shift, unshift,
createElement, appendChild, characterSet, charset,
@@ -420,9 +419,12 @@ if (!this.JSON2) {
setHeartBeatTimer, killFrame, redirectFile, setCountPreRendered,
trackGoal, trackLink, trackPageView, trackSiteSearch,
setEcommerceView, addEcommerceItem, trackEcommerceOrder, trackEcommerceCartUpdate,
- addPlugin, getTracker, getAsyncTracker,
- initialize
-*/
+ addPlugin, getTracker, getAsyncTracker
+ */
+/*global Piwik_Overlay_Client */
+/*members initialize */
+/*global define */
+/*members amd */
var
// asynchronous tracker (or proxy)
_paq = _paq || [],
@@ -463,7 +465,10 @@ var
asyncTracker,
/* iterator */
- i;
+ i,
+
+ /* local Piwik */
+ Piwik;
/************************************************************
* Private methods
@@ -2926,7 +2931,7 @@ var
* Public data and methods
************************************************************/
- return {
+ Piwik = {
/**
* Add plugin
*
@@ -2957,6 +2962,13 @@ var
return asyncTracker;
}
};
+
+ // Expose Piwik as an AMD module
+ if (typeof define === 'function' && define.amd) {
+ define(['piwik'], [], function () { return Piwik; });
+ }
+
+ return Piwik;
}()),
/************************************************************