Get updates via , Github, or RSS | About

Episode 5: Native Modules Jun 16, 2016

Native modules are another way to interact with Javascript through Elm. All interactions are handled through Tasks, which enable your Javascript work to be asynchronous.

Check out a good example in evancz/elm-http’s Http.js

Samples

Native/LocalStorage.js
var _user$project$Native = function() {

  function setItem(key, value) {
    return _elm_lang$core$Native_Scheduler.nativeBinding(function(callback) {
      localStorage.setItem(key, value)
      callback(_elm_lang$core$Native_Scheduler.succeed(key));
    });
  }

  return {
    setItem: F2(setItem)
  }
}();