Skip to content

Commit

Permalink
Merge branch 'gh-pages' of https://github.com/LivelyKernel/lively4-core
Browse files Browse the repository at this point in the history
… into gh-pages
  • Loading branch information
onsetsu committed Apr 22, 2024
2 parents 98a25bc + d50b33f commit 739c9bf
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
60 changes: 60 additions & 0 deletions demos/jsx19.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
'enable rp19-jsx';


/*MD
## Example:
```
import FooMorph from "https://lively-kernel.org/lively4/lively4-jens/demos/jsx19.js"
customElements.define("foo-morph", FooMorph);
that.innerHTML = "<foo-morph></foo-morph>"
```
// that.innerHTML = ""
MD*/

import ReactiveMorph from 'src/client/reactive/components/rewritten/conduit/rpComponents/reactiveMorph.js';

var model = {
name: "Foo"
}


export default class FooMorph extends ReactiveMorph {

/* Event handler */
onRegisterForm(event) {
event.preventDefault();
}

// (1) Project on initialize
render_1() {
return <div>{model.name}</div>

}

// (2) with a loop
render_2() {
return <div>
<div>{model.name + "XXX"}</div>
<button click={() => model.name = "bar"}>change</button>
</div>
}

// (3) with a magic loop ... chanage in input is pushed to model
render() {
// Rewriting ERROR: value={model.name + "XXX"}></input>
return <div>
<form id='registerForm'>
<fieldset>
<input
id='nameInput'
value={model.name}></input>
</fieldset>
</form>
<div>MODEL: {model.name}</div>
</div>
}


}
4 changes: 4 additions & 0 deletions src/client/morphic/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export default class Events {

HTMLElement.prototype.addEventListener = function(type, cb, ...rest) {
// we cannot just wrapp a callback cb, because callbacks are also used in removeEventListener...
if (!cb) {
console.warn("addEventListener: registering empty callback for " + type)
return
}
var func = cbMap.get(cb) || (function(...args) {

// this becomes dangerous... without COP, we need a global flag
Expand Down
1 change: 0 additions & 1 deletion src/components/tools/lively-container-navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,6 @@ export default class LivelyContainerNavbar extends Morph {
eaMethodInfo.class = classInfo.name // for later use
var name = eaMethodInfo.name
var methodItem = this.createDetailsItem(name)
debugger
if (eaMethodInfo.static) {
methodItem.insertBefore(<span class="mod">static</span>, methodItem.querySelector("a"))
}
Expand Down
7 changes: 6 additions & 1 deletion src/external/diffDom.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 739c9bf

Please sign in to comment.