## 2016-05-10 Experimenting with lively.modules


```JS
lively.loadJavaScriptThroughDOM("livelyModules", 
	"https://lively-kernel.org/lively4/lively.modules/dist/lively.modules.js").then( () => {
		lively.notify("loaded modules")	
	})	



	
window.moduleName = lively4url +"/src/client/draft.js"

System.import(moduleName).then(m => window.draft = m)

draft.hello()  // "world4"

lively.modules.moduleEnv(moduleName).recorder.bar = function() { return 3 + 4}

draft.hello() // "world7"

lively.modules.sourceOf(moduleName).then(
  source => lively.openWorkspace(source).then(comp => {
    comp.doSave = (source) => {
      lively.notify("save: " )
      var source =  comp.editor.getValue()
      lively.modules.moduleSourceChange(moduleName,  source)
    }
  })
)


draft.hello function hello() {
        return 'world' + __lvVarRecorder.bar();
    }
lively.modules.sourceOf(moduleName).then( source => that.editor.setValue(source))

// edit source

lively.modules.moduleSourceChange(moduleName,  that.editor.getValue())

draft.hello() // whatever....

lively.vm.


```



##  2016-05-01, #Jens

Major Lively4 UI refactoring and fixes!


Originating in while working on some simple JavaScript to HTML scripts... then in the end are not so easy to use, because the context is missing and we cannot attach callback to pure ASCII text. Or can I? #TODO #Idea... we control both worlds at that time.

```
<lively-script>
lively.files.statFile(lively4url +"")
  .then(t => JSON.parse(t).contents.map(ea => ea.name))
  .then(files => files.filter(ea => !ea.match(/^[.]/)))
  .then(files =>  "" + lively4url +"/" + 
      "<ul style='background-color:lightgray'>" + files.map(ea => "<li><a href='"+ea+"'>" + ea + "</a></li>").join("\n") + "</ul>")
</lively-script>
```

<lively-script>
lively.files.statFile(lively4url +"")
  .then(t => JSON.parse(t).contents.map(ea => ea.name))
  .then(files => files.filter(ea => !ea.match(/^[.]/)))
  .then(files =>  "" + lively4url +"/" + 
      "<ul style='background-color:lightgray'>" + files.map(ea => "<li><a href='"+ea+"'>" + ea + "</a></li>").join("\n") + "</ul>")
</lively-script>


##  2016-04-30, #Jens

### I am so Eval!

Sometimes, I think one has to hit code with a hammer as long and hard till it glows...

Sorry Robert, sorry Stefan... but I want to bind my "this" in my workspace.

I want to be able to select this line and depending on the context eval it to something meaningful.

```
 "I am "+ this 
```

