forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexplorer.js
More file actions
15 lines (12 loc) · 481 Bytes
/
explorer.js
File metadata and controls
15 lines (12 loc) · 481 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const explorerUrl = location.hostname === 'localhost'
? 'http://localhost:3000'
: 'https://graphql.github.com/explorer'
// Pass non-search query params to Explorer app via the iFrame
export default function () {
const graphiqlExplorer = document.getElementById('graphiql')
const queryString = window.location.search
if (!(queryString && graphiqlExplorer)) return
window.onload = () => {
graphiqlExplorer.contentWindow.postMessage(queryString, explorerUrl)
}
}