<commit_before>[![Build Status](https://travis-ci.org/rgrempel/elm-web-api.svg)](https://travis-ci.org/rgrempel/elm-web-api)

[![Sauce Test Status](https://saucelabs.com/browser-matrix/elm-web-api.svg)](https://saucelabs.com/u/elm-web-api)

# elm-web-api

The purpose of this package is to expose various standard web APIs to Elm,
or document where they are already exposed. For reference, I have mostly
relied on the following sources:

* https://developer.mozilla.org/en-US/docs/Web/API
* https://developer.mozilla.org/en-US/docs/WebAPI
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
* https://developers.whatwg.org/

Those pages document the various facilities available in a Javascript web
environment. In order for Elm to use such facilities, it is necessary to write
"native" code. So, I'm plugging away at it -- this is a work in progress,
but if it is useful to you, that would be great.

If there is some particular Javascript API that you'd like to see exposed here,
feel free to create an issue (or, for that matter, a pull request). Otherwise,
I'll continue my semi-random walk.


## Contents

* [Supported browsers](#supportedbrowsers)
* [Installation](#installation)
* APIs
    * [WebAPI.AnimationFrame](#webapianimationframe)
    * [WebAPI.Cookie](#webapicookie)
    * [WebAPI.Document](#webapidocument)
    * [WebAPI.Date](#webapidate)
    * [WebAPI.Event](#webapievent)
        * [WebAPI.Event.BeforeUnload](#webapieventbeforeunload)
        * [WebAPI.Event.Custom](#webapieventcustom)
    * [WebAPI.Function](#webapifunction)
    * [WebAPI.JSON](#webapijson)
    * [WebAPI.Location](#webapilocation)
    * [WebAPI.Math](#webapimath)
    * [WebAPI.Number](#webapinumber)
    * [WebAPI.Screen](#webapiscreen)
    * [WebAPI.Storage](#webapistorage)
    * [WebAPI.Window](#webapiwindow)


## Supported browsers

I have set up testing via Travis and SauceLabs -- you can see at the top
of this page a graphic that indicates which browsers I'm testing against.
Let me know if you think I should try out some older verions as well.


## Installation

Because elm-web-api uses "native" modules, it requires approval before it can
be included in the
[Elm package repository](http://package.elm-lang.org/packages). For a variety of
reasons, it's unlikely to get such approval. Thus, you cannot install
it using `elm-package`.

However, you can still install it and use it via the following steps:

*   Download this respository in one way or another.

    *   You can download specific releases from the
        [releases page](https://github.com/rgrempel/elm-web-api/releases), or
        just check there for the version history.
    
    *   You can clone from git, and then possibly checkout a specific tag:

            git clone https://github.com/rgrempel/elm-web-api.git
            cd elm-web-api
            git checkout 2.1.0     # If you want a specific release

    *   Or, you might use git submodules, if you're adept at that. (I wouldn't
        suggest trying it if you've never heard of them before).

*   Modify your `elm-package.json` to refer to the `src` folder.

    You can choose where you want to put the downloaded code, but wherever that
    is, simply modify your `elm-package.json` file so that it can find the
    `src` folder.  So, the "source-directories" entry in your
    `elm-package.json` file might end up looking like this:

        "source-directories": [
            "src",
            "elm-web-api/src"
        ],

    But, of course, that depends on where you've actually put it, and where the
    rest of your code is.

*   Modify your `elm-package.json` to indicate that you're using 'native' modules.
    To do this, add the following entry to `elm-package.json`:

        "native-modules": true,

Now, doing this would have several implications which you should be aware of.

*   You would, essentially, be trusting me (or looking to verify for yourself)
    that the native code in this module is of high quality and will not cause
    run-time errors or other problems.

*   You would be relying on me to update that code when the mechanism for using
    'native' modules in Elm changes, or when certain other internal details of Elm's
    implementation change. Furthermore, you'd have to check here whenever the Elm
    compiler's version changes, or the Elm core library's version changes, to see
    whether an update is required.
<commit_msg>Update README for current status of the package repository.<commit_after>[![Build Status](https://travis-ci.org/rgrempel/elm-web-api.svg)](https://travis-ci.org/rgrempel/elm-web-api)

[![Sauce Test Status](https://saucelabs.com/browser-matrix/elm-web-api.svg)](https://saucelabs.com/u/elm-web-api)

# elm-web-api

The purpose of this package is to expose various standard web APIs to Elm,
or document where they are already exposed. For reference, I have mostly
relied on the following sources:

* https://developer.mozilla.org/en-US/docs/Web/API
* https://developer.mozilla.org/en-US/docs/WebAPI
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
* https://developers.whatwg.org/

Those pages document the various facilities available in a Javascript web
environment. In order for Elm to use such facilities, it is necessary to write
"native" code. So, I'm plugging away at it -- this is a work in progress,
but if it is useful to you, that would be great.

If there is some particular Javascript API that you'd like to see exposed here,
feel free to create an issue (or, for that matter, a pull request). Otherwise,
I'll continue my semi-random walk.


## Contents

* [Supported browsers](#supportedbrowsers)
* [Installation](#installation)
* APIs
    * [WebAPI.AnimationFrame](#webapianimationframe)
    * [WebAPI.Cookie](#webapicookie)
    * [WebAPI.Document](#webapidocument)
    * [WebAPI.Date](#webapidate)
    * [WebAPI.Event](#webapievent)
        * [WebAPI.Event.BeforeUnload](#webapieventbeforeunload)
        * [WebAPI.Event.Custom](#webapieventcustom)
    * [WebAPI.Function](#webapifunction)
    * [WebAPI.JSON](#webapijson)
    * [WebAPI.Location](#webapilocation)
    * [WebAPI.Math](#webapimath)
    * [WebAPI.Number](#webapinumber)
    * [WebAPI.Screen](#webapiscreen)
    * [WebAPI.Storage](#webapistorage)
    * [WebAPI.Window](#webapiwindow)


## Supported browsers

I have set up testing via Travis and SauceLabs -- you can see at the top
of this page a graphic that indicates which browsers I'm testing against.
Let me know if you think I should try out some older verions as well.


## Installation

Because elm-web-api uses 'native' modules, it cannot be included in the
[Elm package repository](http://package.elm-lang.org/packages). Thus, you cannot
install it using `elm-package`.

However, you can still install it and use it via the following steps:

*   Download this respository in one way or another.

    *   You can download specific releases from the
        [releases page](https://github.com/rgrempel/elm-web-api/releases), or
        just check there for the version history.
    
    *   You can clone from git, and then possibly checkout a specific tag:

            git clone https://github.com/rgrempel/elm-web-api.git
            cd elm-web-api
            git checkout 2.1.0     # If you want a specific release

    *   Or, you might use git submodules, if you're adept at that. (I wouldn't
        suggest trying it if you've never heard of them before).

*   Modify your `elm-package.json` to refer to the `src` folder.

    You can choose where you want to put the downloaded code, but wherever that
    is, simply modify your `elm-package.json` file so that it can find the
    `src` folder.  So, the "source-directories" entry in your
    `elm-package.json` file might end up looking like this:

        "source-directories": [
            "src",
            "elm-web-api/src"
        ],

    But, of course, that depends on where you've actually put it, and where the
    rest of your code is.

*   Modify your `elm-package.json` to indicate that you're using 'native' modules.
    To do this, add the following entry to `elm-package.json`:

        "native-modules": true,

Now, doing this would have several implications which you should be aware of.

*   You would, essentially, be trusting me (or looking to verify for yourself)
    that the native code in this module is of high quality and will not cause
    run-time errors or other problems.

*   It is predictable that this module will need some changes when a new
    version of Elm is released. Therefore, you would need to remember to check
    here for such changes when that happens.

*   It has been said that Elm 0.17 will include additional support for bindings
    to Javascript platform APIs. This may make this module redundant (in whole
    or in part), or it may make it easier or harder to implement or install.

{'fraction_non_alphanumeric': 0.09392949656492848, 'fraction_numerical': 0.0010136276607726096, 'mean_word_length': 3.4047619047619047, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '545962', 'n_tokens_mistral': 2692, 'n_tokens_neox': 2528, 'n_words': 1027}