Commit e9252031 authored by Jake Read's avatar Jake Read

slowly figuring out how to module-ify bower

parent 15d7b772
......@@ -516,7 +516,7 @@ document.onkeydown = function(evt) {
function writeModuleOptionMenu(modRep) {
var menuDom = document.createElement('div')
menuDom.id = 'perModuleMenu'
menuDom.style.left = 10 + modrep.dom.domElem.offsetLeft + modrep.dom.domElem.offsetWidth + 'px'
menuDom.style.left = 10 + modRep.dom.domElem.offsetLeft + modRep.dom.domElem.offsetWidth + 'px'
menuDom.style.top = modRep.dom.domElem.offsetTop + 'px'
// future: rm all inputs, rm all outputs, rename, open (heirarchy)
var opts = ['delete', 'copy']
......
......@@ -256,42 +256,29 @@ function writeUiElement(container, rep, key) {
// pull the representation object from what we were sent
var ui = rep.ui[key]
console.log('write ui', ui)
console.log('at rep', rep)
//import script from ui.clientPath
// load this thing,
ui.script = document.createElement('script')
container.appendChild(ui.script)
// it loads and executes when this is set
ui.script.src = ui.clientPath
// events
ui.script.onerror = function(err){
console.log('ERR from ui script', err)
}
ui.script.onload = function(msg){
console.log('script loaded ?')
}
container.appendChild(ui.script)
ui.script.src = ui.clientPath
// make an xhttp request for the code
/*
var request = new XMLHttpRequest()
request.open('GET', ui.clientPath)
request.responseType = 'text/javascript'
request.onLoad = function() {
console.log(request.response)
ui.script.onload = function(msg){
console.log('script loaded')
// how many of these functions exist ?
registerNewModule(rep.description.id, key)
}
request.send()
fetch(ui.clientPath).then(function(response) {
response.text().then(function(text) {
console.log(text)
console.log(ui)
ui.script.appendChild(document.createTextNode(text))
container.apppendChild(ui.script)
})
})
*/
// now we'll hook it up to the socket ?
/*
// give it access to the socket,
......
console.log('hello lib load')
\ No newline at end of file
(function(){
socketSend('console', 'loading new iife')
this.init = function(){
socketSend('console', 'hello from' + this.parentId + this.key)
}
// expect this to only be used once
window.registerNewModule = function(id, key){
this.parentId = id
this.key = key
this.init()
}
})()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment