Skip to content

cosmn/dom-event-to-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

For those cases where developer tools are not available,
and debugging events turns difficult. E.g. Chrome on iOS without a Mac

Usage

parse(object:Object, [depth:Int]):Object

Examples

import { parse } from 'dom-event-to-json'

element.addEventListener('click', (event) => {
    fetch('/debug', {
        method: 'POST',
        body: JSON.stringify( parse(event) ),
        headers: new Headers({
          'Content-Type': 'application/json'
        })
    })
})
<script src="https://cdn.rawgit.com/cosmn/dom-event-to-json/3bedcc44/dist/domEventToJSON.js"></script>
<script>
element.addEventListener('click', function(event){
    console.log( domEventToJSON.parse(event) )
})
</script>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published