This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns circuit-slave.ajax.core | |
(:require goog.net.EventType | |
goog.net.ErrorCode | |
goog.net.XhrIo | |
[goog.Uri.QueryData :as query-data] | |
[goog.structs :as structs] | |
[goog.events :as events] | |
[clojure.string :as str] | |
[clojure.walk :refer [stringify-keys]] | |
[cljs.core.async :as async :refer [chan alts! put! close!]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn ajax-request | |
[{:keys [method api interceptors] :as opts}] | |
(let [response-format (get-response-format opts) | |
method (normalize-method method) | |
[uri body headers] (process-inputs (apply-interceptors :response | |
(or interecptors @default-interceptors) | |
opts) | |
response-format) | |
handler (base-handler response-format opts) | |
api (or api (new goog.net.XhrIo))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajaxSetup({ | |
beforeSend: (xhr, settings) => | |
console.log("appending auth headers to request"); | |
Auth.appendAuthHeaders(xhr, settings) | |
} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ApiUtil = function() {}; | |
ApiUtil.prototype.getProxyUrl = function() { | |
return "/proxy"; | |
}; | |
ApiUtil.prototype.getApiUrl = function() { | |
return (window.isOldIE()) | |
? this.getProxyUrl() | |
: window.CONFIG.apiUrl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ApiMixin = { | |
getProxyUrl: function() { | |
return "/proxy"; | |
}, | |
getApiUrl: function() { | |
return (window.isOldIE()) | |
? this.getProxyUrl() | |
: window.CONFIG.apiUrl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getApiUrl = function() { | |
return (window.isOldIE()) | |
? "/proxy" | |
: window.CONFIG.apiUrl; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- assign CommonJS modules to global namespace --> | |
<script> | |
window.commonJS = require('dbx_apps_engine/dbx_apps_common'); | |
window.$ = window.jQuery = window.commonJS.jquery; | |
window._ = window.commonJS.lodash; | |
window.React = window.commonJS.react; | |
</script> | |
<!-- turn it up --> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @jsx React.DOM | |
*/ | |
import { default as React } from "react"; | |
import { Router } from "react-router"; | |
import { history } from "react-router/lib/HashHistory"; | |
import { default as Inner } from "./inner"; | |
import { default as Login } from "./login"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; the following env vars have been set in profiles.clj | |
{:profiles/dev {:env {:sauce-username "xxxxxxxxxxxxxxx" | |
:sauce-key "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy" | |
:max-sauce-connections 2} | |
:local-target-test-platforms [{:browser :firefox}] | |
:sauce-target-test-platforms [{:browser :firefox} | |
{:browser :chrome} | |
{:browser :safari}]}} | |
;;; test runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- include the browserify-compiled CommonJS module --> | |
<%= javascript_include_tag 'dbx_apps_engine/dbx_apps_common' %> | |
<!-- assign CommonJS modules to global namespace --> | |
<script> | |
window.commonJS = require('dbx_apps_engine/dbx_apps_common'); | |
window.$ = window.jQuery = window.commonJS.jquery; | |
window._ = window.commonJS.lodash; | |
window.React = window.commonJS.react; | |
</script> |