Export or edit this event...

Using Ports in Elm

Jaguar Land Rover Tech Incubator
1450 NW 18th Ave
Portland, Oregon 97209, United States (map)

Website

Description

So you're using Elm and enjoying all of the benefits it provides with its abstraction of the web platform. But what do you do if you're dealing with a browser API that isn't implemented in Elm yet? Or you need to ship a feature and don't have the time to rewrite that really cool JavaScript library in Elm? Or maybe you want to hook your app up to Firebase or some other database that has a JavaScript SDK?

This is where ports come in. Ports allow you to hook up commands and subscriptions to JavaScript code, letting you leverage the entire JavaScript ecosystem, while providing the structure necessary to ensure you aren't introducing runtime exceptions in your Elm code.

We'll cover the basics of setting up ports in your Elm code, walk through some common use cases, and hopefully you'll leave the evening ready to bring your JavaScript and Elm knowledge together!

Ben Brandt lives in Portland and is a front-end developer at Monk Development. He has recently discovered the joys of using functional programming for building UI's and is trying to use Elm wherever people will let him.

Share

Tags