Skip to content

Commit

Permalink
Update config-static/README.md
Browse files Browse the repository at this point in the history
Co-authored-by: Emma Russell <[email protected]>
  • Loading branch information
M-Kusumgar and EmmaLRussell authored Jan 6, 2025
1 parent 5ea22cd commit 2d6684c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion config-static/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ We also build `wodin` frontend in static mode (just normal `wodin` frontend with
The `wodinStatic.ts` script is the entrypoint for run time wodin static. This script does the following:
1. Loads third party CDN scripts (e.g. for mathjax). It does this by creating a script tag with the right source and appends it to the body of the HTML document.
1. Awaits blocking scripts, e.g. loading the `runnerOde.js` and `runnerDiscrete.js`, that the app cannot run without, these runners loaded as global variables `odinjs` and `dust` respectively.
1. Queries the document and finds all `data-w-store` tags (data tags that define what stores to use for that component). This is a list of all the stores the user has used in the HTML document and the values should match the `<store-name>` folder names in the user's config.
1. Queries the document and finds all tags with `data-w-store` attributes - these tags define the wodin components to render by class name, and the `data-w-store` attribute specifies the name of the store to use. These attribute values define all the stores requires by the site, and should match the `<store-name>` folder names in the user's config.
1. Gets the `stores/<store-name>/config.json` and `stores/<store-name>/model.json` for only the stores the user has used in the page.
1. For each `<store-name>` the user has used in the page, it initialises the store with the config, runners (using the global variables), model and finally runs the model with the runners. This initialisation was the responsibility of on mount hook of components like `WodinSession.vue` but we no longer mount those components so we have to manually initialise the store. Note: the api service is disabled in the wodin static build so returns undefined for all responses, this may break things if you want to mount certain components that do api requests. We intend to fix this soon.
1. For each `<store-name>` we loop over the components we want to mount. We define a selector for each one in `componentsAndSelectors` function and query the DOM for these selectors making sure they have `data-w-store` tag with value `<store-name>`. We mount the component to the correct selector with the correct store. `index.html` in this folder includes examples of all supported components.

0 comments on commit 2d6684c

Please sign in to comment.