-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-46 Add javacript run before model run
- Loading branch information
1 parent
c686dec
commit 559976a
Showing
5 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import configuration from './configuration' | ||
import generateTemplate from '@runtime/builders/generateTemplate' | ||
|
||
export default () => { | ||
const script = `const javascript = ${generateTemplate(configuration())}` | ||
const html = '' | ||
const css = '' | ||
|
||
return { script, html, css } | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import configureStore from '@src/configureStore' | ||
import { getJavascripts } from '@reducers' | ||
|
||
export default () => { | ||
const store = configureStore().store.getState() | ||
|
||
let javascript = { | ||
onBeforeModelRun: [] | ||
} | ||
|
||
Object.entries(getJavascripts(store)).forEach(([, item]) => { | ||
const fn = `function() {${item.javascript}}` | ||
javascript.onBeforeModelRun.push(new Function(`return ${fn}`)()) | ||
}) | ||
|
||
return javascript | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,4 @@ export default function init() { | |
|
||
this.instantiate() | ||
this.setup() | ||
this.play() | ||
} | ||
} |