# Static media

Includes our javascript API `js/scarab-v2.js`, and a bunch of not-so-important stuff.

[JS API reference](https://help.emarsys.com/hc/en-us/articles/214245625-Data-Collection-JavaScript-API-Reference)

## Guidelines for contributors

- This project has to run in browsers supporting ES3. No fancy stuff here, sorry.
- [JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html)
- This project is linted with `jshint`. See `./.jshintrc` for the rules.
- Use a linter plugin in your editor, eg. http://www.sublimelinter.com/

## Let's build already!

### install

    npm install

### unit tests

    ./node_modules/karma/bin/karma start

(keeps running watches files for changes)

### browserstack tests

- log in to browserstack with credentials: https://secret.emarsys.net/cred/detail/314/ .
- create a separate service account at https://www.browserstack.com/accounts/settings
- run the command:


    BROWSERSTACK_USER={user} BROWSERSTACK_KEY={api key} node_modules/karma/bin/karma start karma.browserstack.conf.js

### linting

**TODO: make it part of build process**

    jshint js/scarab*.js js/js-test/scarab*spec.js
    # TODO make it actually succeed.

### jsfiddle for local testing

    cd ..
    python3 -m http.server &
    open 'http://jsfiddle.net/scarabresearch/2jwfk44r/'

