From 436bb72e2855ee079ac3eae92935307f2450c214 Mon Sep 17 00:00:00 2001 From: Benjamin LONGEARET Date: Thu, 4 Jun 2015 08:05:20 +0200 Subject: [PATCH 1/3] Fix atob context error --- github.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github.js b/github.js index 52582a14..5ad2ab96 100644 --- a/github.js +++ b/github.js @@ -16,7 +16,7 @@ // Initial Setup // ------------- - var XMLHttpRequest, _; + var XMLHttpRequest, _, atob = window.atob; /* istanbul ignore else */ if (typeof exports !== 'undefined') { XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; From 4665ea0220d14fd823f723260383f08dc119b4d3 Mon Sep 17 00:00:00 2001 From: Benjamin LONGEARET Date: Sat, 6 Jun 2015 09:15:49 +0200 Subject: [PATCH 2/3] Remove hoisting from var btoa --- github.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github.js b/github.js index 5ad2ab96..3b191be7 100644 --- a/github.js +++ b/github.js @@ -16,13 +16,13 @@ // Initial Setup // ------------- - var XMLHttpRequest, _, atob = window.atob; + var XMLHttpRequest, _; /* istanbul ignore else */ if (typeof exports !== 'undefined') { XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; _ = require('underscore'); if (typeof btoa === 'undefined') { - var btoa = require('btoa'); //jshint ignore:line + btoa = require('btoa'); //jshint ignore:line } } else { From 5d0c9a444e29fc60a1ba6586589b4372acb31d21 Mon Sep 17 00:00:00 2001 From: Benjamin LONGEARET Date: Mon, 22 Jun 2015 17:06:42 +0200 Subject: [PATCH 3/3] Use window.btoa if in browser mode --- github.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github.js b/github.js index 3b191be7..77a03371 100644 --- a/github.js +++ b/github.js @@ -16,7 +16,7 @@ // Initial Setup // ------------- - var XMLHttpRequest, _; + var XMLHttpRequest, _, btoa; /* istanbul ignore else */ if (typeof exports !== 'undefined') { XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; @@ -24,9 +24,9 @@ if (typeof btoa === 'undefined') { btoa = require('btoa'); //jshint ignore:line } - } else { - _ = window._; + _ = window._; + btoa = window.btoa; } //prefer native XMLHttpRequest always