JSPM

create-point-cb

1.2.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 72992
    • Score
      100M100P100Q156025F
    • License MIT

    Create a point from a DOM event

    Package Exports

    • create-point-cb

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (create-point-cb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    create-point-cb

    Install

    npm install --save create-point-cb

    Usage

    var createPointCB = require('create-point-cb'),
        myPoint = {},
        pointCB = createPointCB(myPoint);
    
    window.addEventListener('mousemove', pointCB, false);
    window.addEventListener('touchmove', pointCB, false);

    About

    Any object you pass to createPointCB will get these properties:

    • x (the document window x coordinate)
    • y (the document window y coordinate)
    • target (the current event.target)
    • element (this value inside the event callback)
    • pageX (the event.pageX value)
    • pageY (thie event.pageY value)
    • type (the event.type)

    Use create-point-cb with any DOM event that will have clientX, or clientY properties. This usually would be mousemove, or the touchmove event on the window object.

    Happy coding. :)