1
0
mirror of synced 2025-12-22 11:26:57 -05:00
Files
docs/javascripts/explorer.js

16 lines
481 B
JavaScript

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)
}
}