Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix videos on JS case study article #15

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions content/case-study-foreign-integration-js-browser/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ main = do
In the above snippet we're creating an `IORef` and pass a callback incrementing it to a foreign function that installs a button in body, counting a number of clicks
(note for brevity I used a multiline syntax that is not yet available for foreign calls). The callback closes over the `IORef` and correctly updates the number after each click.

<video controls>
<source src="https://github.com/user-attachments/assets/ceb86903-d136-4821-8e2d-de2e433889a5" type="video/quicktime" />
</video>

<center>
<video src="https://github.com/user-attachments/assets/ceb86903-d136-4821-8e2d-de2e433889a5" type="video/quicktime" controls></video>
</center>

Callbacks fully enable probably the most fascinating purpose of JavaScript backend, which is web programming. GHCJS has been around for quite some time now,
however it is both outdated (being a GHC fork requiring separate maintenance; currently stuck on 8.10) and cumbersome to use (often necessitating a separate setup, typically through Nix). In one of my previous companies, while evaluating potential options for rewriting the frontend, I decided to use PureScript. It was close enough to Haskell and very easy to set up - it can be installed directly through `npm`, has its own `stack`-like package manager `spago` with a suite of existing bundler plugins, and a blazing fast language server.
Expand Down Expand Up @@ -406,9 +405,9 @@ Starting up http-server, serving dist/

Behold, a material button!

<video controls>
<source src="https://github.com/user-attachments/assets/4abe2e52-0bd2-4cb7-99c0-c0b0a1796528" type="video/quicktime" />
</video>
<center>
<video src="https://github.com/user-attachments/assets/4abe2e52-0bd2-4cb7-99c0-c0b0a1796528" type="video/quicktime" controls></video>
</center>

### Bundling with `webpack` and `swc-loader`

Expand Down
Loading