ScalaJS Facade for Mousetrap
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

ScalaJS Mousetrap Facade

This is a ScalaJS facade for Mousetrap.


Step 1. Add JitPack to your repositories in SBT:

resolvers += "jitpack" at ""

Step 2. Add this repo as a dependency:

libraryDependencies += "blog.codeninja" % "scala-js-mousetrap" % "1.6.1"

If you'd like the latest-and-greatest version, use "master-SNAPSHOT".

Example Usage

Perform a simple HTTP get, wait for it, and print the response.

import scala.scalajs.js
import org.scalajs.dom
import blog.codeninja.scalajs.mousetrap._

object Example {
    def main(args: Array[String]) = {
        Mousetrap.bind("alt+k", (e: dom.Event) => println("Hello, world!"))

The entire Mousetrap is implemented and type safe. Additionally, a few extra case classes are implemented for some constant strings.

That's It

If you find a bug or have suggestions on how to improve the facade (specifically adding some more type safety where possible), please open an issue and tell me about it.

Hope you find this helpful!