ilyakooo0/airlock/1.0.0

NOTE: the latest version is 1.1.1

Renamed to iko-soy/airlock. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as ilyakooo0/airlock still install under that name. 4 versions of 4 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/iko-soy/airlock.

What we checked: The repo moved to github.com/iko-soy/airlock. Rebuilt with git archive from commit 4c68317223df of https://github.com/iko-soy/airlock (zip prefix ilyakooo0-airlock-d44999c/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 3f2e9f4cbfdf20ec2d5e44df6fd8d2d01fa28d12.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/ilyakooo0/airlock/zipball/1.0.0/

Airlock

Usage

Demo

DEMO

FFI

Urbit subscriptions require server-side event (SSE). Unfortunately, Elm does not provide a native implementation. This means that we will need to use JS FFI (aka ports).

Setting up the Elm side

You would need to declare two ports for Airlock to use:

  1. port createEventSource : String -> Cmd msg
 This sets up the SSE channel.
  1. port onEventSourceMessage : (JD.Value -> msg) -> Sub msg This recieves the actual messages from the SSE channel.

These two functions need to be passed to one of the functions from Ur.Run module. The functions in Ur.Run are the same as functions from Browser, but have a couple of extra urbit-specific fields.

Setting up the JS side

The SSE JS code is neatly packed into example/fetch-event-source.js. All you need to do is pass them to Elm ports like in example/script.js.

You can see a full working example in example.