Created
March 11, 2020 13:40
-
-
Save nilshartmann/e769c526b16bd1252de0e12f952c0e07 to your computer and use it in GitHub Desktop.
sprotty wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SprottyWrapper { | |
componentDidMount() { | |
// Diagramm erzeugen, wie in multicore.ts (hier stark gekürzt:) | |
this.processor = ...; | |
const modelSource = container.get<LocalModelSource>(TYPES.ModelSource); | |
modelSource.setModel(this.processor); | |
this.actionDispatcher = container.get<IActionDispatcher>(TYPES.IActionDispatcher); | |
} | |
componentDidUpdate() { | |
this.changeModel(); | |
} | |
changeModel = () => { | |
// this.processor hier mit neuen Properties der Komponente (this.props) aktualisieren | |
for (let i = 0; i < this.processor.children!.length; ++i) { | |
const child = this.processor.children![i]; | |
if (child.type === 'simplecore' && Math.random() > 0.7) { | |
(child as CoreSchema).kernelNr = Math.round(Math.random() * 11); | |
} | |
} | |
this.actionDispatcher.dispatch(new UpdateModelAction(this.processor)); | |
} | |
render () { | |
return <div ><div>...</div></div>; // mit den benötigten Ids, siehe di.config.ts | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment