Skip to content

Commit 9bcaade

Browse files
committed
v0.0.4 release
Fix reference to proper lib file for server usage (fixes #32) Upgrade internal JSON dep to JSON3 (resolves #33) Update CHANGELOG.md and README.md
1 parent 9603363 commit 9bcaade

16 files changed

+652
-461
lines changed

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
<!--
2-
<a name="unreleased"></a>
3-
# Unreleased
2+
<a name="{version}"></a>
3+
# {version}
4+
**FIXED:**
5+
**NEW:**
6+
**BREAKING:**
47
-->
58

9+
<a name="0.0.4></a>
10+
# 0.0.4
11+
12+
**FIXED:**
13+
* Fix reference to proper lib file for server usage (#32)
14+
15+
**NEW:**
16+
* Upgrade internal JSON dep to JSON3 (#33)
17+
18+
619
<a name="0.0.3"></a>
720
# 0.0.3
821

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Copy/paste this snippet of JavaScript above the </head> tag of your page to load
9393
// Loads the library asynchronously from any URI
9494
!function(name,path,ctx){
9595
var latest,prev=name!=='Keen'&&window.Keen?window.Keen:false;ctx[name]=ctx[name]||{ready:function(fn){var h=document.getElementsByTagName('head')[0],s=document.createElement('script'),w=window,loaded;s.onload=s.onerror=s.onreadystatechange=function(){if((s.readyState&&!(/^c|loade/.test(s.readyState)))||loaded){return}s.onload=s.onreadystatechange=null;loaded=1;latest=w.Keen;if(prev){w.Keen=prev}else{try{delete w.Keen}catch(e){w.Keen=void 0}}ctx[name]=latest;ctx[name].ready(fn)};s.async=1;s.src=path;h.parentNode.insertBefore(s,h)}}
96-
}('Keen','https://d26b395fwzu5fz.cloudfront.net/keen-tracking-0.0.3.min.js',this);
96+
}('Keen','https://d26b395fwzu5fz.cloudfront.net/keen-tracking-0.0.4.min.js',this);
9797
9898
// Executes when the library is loaded and ready
9999
Keen.ready(function(){

dist/keen-tracking.js

Lines changed: 611 additions & 435 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/keen-tracking.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/keen-tracking.min.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var Emitter = require('component-emitter');
2-
var JSON2 = require('JSON2');
2+
var json = require('./utils/json');
33

44
var each = require('./utils/each');
55
var extend = require('./utils/extend');
@@ -126,7 +126,7 @@ function serialize(data){
126126
var query = [];
127127
each(data, function(value, key){
128128
if ('string' !== typeof value) {
129-
value = JSON2.stringify(value);
129+
value = json.stringify(value);
130130
}
131131
query.push(key + '=' + encodeURIComponent(value));
132132
});

lib/record-events-browser.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var base64 = require('./utils/base64');
33
var each = require('./utils/each');
44
var extend = require('./utils/extend');
55
var extendEvents = require('./extend-events');
6-
var JSON2 = require('JSON2');
6+
var json = require('./utils/json');
77

88
module.exports = {
99
'recordEvent': recordEvent,
@@ -67,7 +67,7 @@ function recordEvent(eventCollection, eventBody, callback, async){
6767

6868
getRequestUrl = this.url(this.writePath() + '/' + encodeURIComponent(eventCollection), {
6969
api_key : this.writeKey(),
70-
data : base64.encode(JSON2.stringify(extendedEventBody)),
70+
data : base64.encode( json.stringify(extendedEventBody) ),
7171
modified : new Date().getTime()
7272
});
7373
getRequestUrlOkLength = getRequestUrl.length < getUrlMaxLength();
@@ -271,7 +271,7 @@ function sendXhr(method, url, data, callback){
271271
if (xhr.readyState == 4) {
272272
if (xhr.status >= 200 && xhr.status < 300) {
273273
try {
274-
response = JSON2.parse(xhr.responseText);
274+
response = json.parse( xhr.responseText );
275275
} catch (e) {
276276
Keen.emit('error', 'Could not parse HTTP response: ' + xhr.responseText);
277277
if (cb) {
@@ -296,7 +296,7 @@ function sendXhr(method, url, data, callback){
296296
xhr.setRequestHeader('Content-Type', 'application/json');
297297

298298
if (data) {
299-
payload = JSON2.stringify(data);
299+
payload = json.stringify(data);
300300
}
301301

302302
if (method.toUpperCase() === 'GET') {

lib/utils/cookie.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var Cookies = require('cookies-js');
2-
var JSON2 = require('JSON2');
2+
var json = require('./json');
33
var extend = require('./extend');
44

55
module.exports = cookie;
@@ -22,7 +22,7 @@ cookie.prototype.get = function(str){
2222
var data = {};
2323

2424
if (Cookies.get(this.config.key)) {
25-
data = JSON2.parse( decodeURIComponent(Cookies.get(this.config.key)) );
25+
data = json.parse( decodeURIComponent(Cookies.get(this.config.key)) );
2626
}
2727
if (str) {
2828
return ('undefined' !== typeof data[str]) ? data[str] : null;
@@ -40,7 +40,7 @@ cookie.prototype.set = function(str, value){
4040
else if ('object' === typeof str && arguments.length === 1) {
4141
extend(this.data, str);
4242
}
43-
Cookies.set(this.config.key, encodeURIComponent( JSON2.stringify(this.data) ), this.config.options);
43+
Cookies.set(this.config.key, encodeURIComponent( json.stringify(this.data) ), this.config.options);
4444
return this;
4545
};
4646

lib/utils/deepExtend.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var JSON2 = require('JSON2');
1+
var json = require('./json');
22

33
module.exports = deepExtend;
44

@@ -30,5 +30,5 @@ function deepExtend(target){
3030
}
3131

3232
function clone(input){
33-
return JSON2.parse(JSON2.stringify(input))
33+
return json.parse( json.stringify(input) );
3434
}

0 commit comments

Comments
 (0)