remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/test-browser/plugin/remix.js

39 lines
1.2 KiB

7 years ago
function receiveMessage (event) {
console.log('receiveMessage', event.data, event.source, event.origin)
document.getElementById('compilationdata').innerHTML += event.data + '<br>'
}
window.addEventListener('message', receiveMessage, false)
window.onload = function () {
document.querySelector('input#testmessageadd').addEventListener('click', function () {
window.parent.postMessage(JSON.stringify({
action: 'request',
key: 'editor',
7 years ago
type: 'setConfig',
value: [document.getElementById('filename').value, document.getElementById('valuetosend').value],
7 years ago
id: 34
}), '*')
7 years ago
})
document.querySelector('input#testmessageremove').addEventListener('click', function () {
window.parent.postMessage(JSON.stringify({
action: 'request',
key: 'editor',
7 years ago
type: 'removeConfig',
value: [document.getElementById('filename').value],
7 years ago
id: 35
}), '*')
7 years ago
})
document.querySelector('input#testmessagerget').addEventListener('click', function () {
window.parent.postMessage(JSON.stringify({
action: 'request',
key: 'editor',
7 years ago
type: 'getConfig',
value: [document.getElementById('filename').value],
7 years ago
id: 36
}), '*')
7 years ago
})
}