clean up error handling

    adapted the example and added lock files when writing to the
    filesystem
    JS binding now actually check the status codes of the XHR objects
    and log to console on error
Merge branch 'error'
add docs or somethings like that..
Merge branch 'docs'