Skip to content

Commit

Permalink
fixes #3352 - expose Piwik as an AMD module (uses the jQuery approach…
Browse files Browse the repository at this point in the history
… for backward compatibility)
  • Loading branch information
robocoder committed Mar 24, 2013
1 parent e233eba commit 2eed2eb
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions js/piwik.js
Expand Up @@ -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,
Expand Down Expand Up @@ -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 || [],
Expand Down Expand Up @@ -463,7 +465,10 @@ var
asyncTracker,

/* iterator */
i;
i,

/* local Piwik */
Piwik;

/************************************************************
* Private methods
Expand Down Expand Up @@ -2926,7 +2931,7 @@ var
* Public data and methods
************************************************************/

return {
Piwik = {
/**
* Add plugin
*
Expand Down Expand Up @@ -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;
}()),

/************************************************************
Expand Down

0 comments on commit 2eed2eb

Please sign in to comment.