{"_id":"premonish","_rev":"6-bcf9c8a0cc2aaf94a021cb65f376d39a","name":"premonish","description":"Predict which DOM element a user will interact with next.","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.1":{"name":"premonish","version":"1.0.1","description":"Predict which DOM element a user will interact with next.","main":"lib/index.js","scripts":{"example":"budo examples/debug.js --live -o -- -t [ babelify --presets [ es2015 ] ] -t browserify-css","build":"babel src --out-dir lib","build-gh-pages":"browserify examples/debug.js -t [ babelify --presets [ es2015 ] ] -t browserify-css | indexhtmlify | metadataify --title \"premonish | mathisonian\" > ../gh-pages/premonish/index.html","test":"semistandard src/** test/** && mocha --compilers js:babel-core/register","syntax-fix":"semistandard --fix"},"repository":{"type":"git","url":"git+https://github.com/mathisonian/premonish.git"},"keywords":["prediction","optimization","preload"],"author":{"name":"Matthew Conlen"},"license":"MIT","bugs":{"url":"https://github.com/mathisonian/premonish/issues"},"homepage":"https://github.com/mathisonian/premonish#readme","devDependencies":{"babel-cli":"^6.18.0","babel-preset-es2015":"^6.18.0","babelify":"^7.3.0","browserify-css":"^0.9.2","budo":"^9.2.2","d3-selection":"^1.0.3","d3-transition":"^1.0.3","expect":"^1.20.2","indexhtmlify":"^1.3.1","metadataify":"^1.0.2","mocha":"^3.2.0","semistandard":"^9.1.0"},"dependencies":{"curve-store":"^1.1.1","d3-voronoi":"^1.1.0","raf":"^3.3.0"},"gitHead":"958974a7ef836b57d454f62f279d0ecd112e64e4","_id":"premonish@1.0.1","_shasum":"86913e8d8dc4ab9179cb91f3bb9efbd13e6437cc","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"mathisonian","email":"mc@mathisonian.com"},"dist":{"shasum":"86913e8d8dc4ab9179cb91f3bb9efbd13e6437cc","tarball":"https://registry.npmjs.org/premonish/-/premonish-1.0.1.tgz","integrity":"sha512-yyDZsYOCD5/XS878OACKM88DojmISCmmXvyPD0zbhFOVVNF1pa3qlt80EeWhSDQvJ248Z7S/uGdkr0tx2mmiCg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDzFb+OB61RdReZRNqO+HKhHAt+bZi8XhFr0Y86bYDK9AIhAI2khKAieJjWf76+i540sdFGmmUzzs1b9g0MCETD06V9"}]},"maintainers":[{"name":"mathisonian","email":"mc@mathisonian.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/premonish-1.0.1.tgz_1480648338237_0.2799190408550203"}},"1.0.2":{"name":"premonish","version":"1.0.2","description":"Predict which DOM element a user will interact with next.","main":"lib/index.js","scripts":{"example":"budo examples/debug.js --live -o -- -t [ babelify --presets [ es2015 ] ] -t browserify-css","build":"babel src --out-dir lib","build-gh-pages":"browserify examples/debug.js -t [ babelify --presets [ es2015 ] ] -t browserify-css | indexhtmlify | metadataify --title \"premonish | mathisonian\" > ../gh-pages/premonish/index.html","test":"semistandard src/** test/** && mocha --compilers js:babel-core/register","syntax-fix":"semistandard --fix"},"repository":{"type":"git","url":"git+https://github.com/mathisonian/premonish.git"},"keywords":["prediction","optimization","preload"],"author":{"name":"Matthew Conlen"},"license":"MIT","bugs":{"url":"https://github.com/mathisonian/premonish/issues"},"homepage":"https://github.com/mathisonian/premonish#readme","devDependencies":{"babel-cli":"^6.18.0","babel-preset-es2015":"^6.18.0","babelify":"^7.3.0","browserify-css":"^0.9.2","budo":"^9.2.2","d3-selection":"^1.0.3","d3-transition":"^1.0.3","expect":"^1.20.2","indexhtmlify":"^1.3.1","metadataify":"^1.0.2","mocha":"^3.2.0","semistandard":"^9.1.0"},"dependencies":{"curve-store":"^1.1.1","d3-voronoi":"^1.1.0","raf":"^3.3.0"},"gitHead":"17d66b7f8e840434cf9f4a00d23dd2efb2572aa4","_id":"premonish@1.0.2","_shasum":"1e348a7a11b7b2f8fdca282b2129098f4b0738e2","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"mathisonian","email":"mc@mathisonian.com"},"dist":{"shasum":"1e348a7a11b7b2f8fdca282b2129098f4b0738e2","tarball":"https://registry.npmjs.org/premonish/-/premonish-1.0.2.tgz","integrity":"sha512-PYLdKd1pvo4yzigrFpufxdnL/hF4G21FHsD8yIgwP8hS7OQoRhKwwCZA+2cFabBBBvWuFAAQ4LxtdrHAKkEXbg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEjNRbl6BxnAjJb9ypsUEZ+ai95xM8uSlweg3BDYgVuIAiAkf2xLGyA5YVC5DXaKYydkZUuNoP8H/hAShiw0fWBAHA=="}]},"maintainers":[{"name":"mathisonian","email":"mc@mathisonian.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/premonish-1.0.2.tgz_1480648405933_0.27429321338422596"}},"1.0.3":{"name":"premonish","version":"1.0.3","description":"Predict which DOM element a user will interact with next.","main":"lib/index.js","scripts":{"example":"budo examples/debug.js --live -o -- -t [ babelify --presets [ es2015 ] ] -t browserify-css","build":"babel src --out-dir lib","compile":"browserify src/index.js -t [ babelify --presets [ es2015 ] ]","build-gh-pages":"browserify examples/debug.js -t [ babelify --presets [ es2015 ] ] -t browserify-css | indexhtmlify | metadataify --title \"premonish\" > ../gh-pages/premonish/index.html","test":"semistandard src/** test/** && mocha --compilers js:babel-core/register","syntax-fix":"semistandard --fix"},"repository":{"type":"git","url":"git+https://github.com/mathisonian/premonish.git"},"keywords":["prediction","optimization","preload"],"author":{"name":"Matthew Conlen"},"license":"MIT","bugs":{"url":"https://github.com/mathisonian/premonish/issues"},"homepage":"https://github.com/mathisonian/premonish#readme","devDependencies":{"babel-cli":"^6.18.0","babel-preset-es2015":"^6.18.0","babelify":"^7.3.0","browserify-css":"^0.9.2","budo":"^9.2.2","d3-selection":"^1.0.3","d3-transition":"^1.0.3","expect":"^1.20.2","indexhtmlify":"^1.3.1","metadataify":"^1.0.2","mocha":"^3.2.0","semistandard":"^9.1.0"},"dependencies":{"curve-store":"^1.1.2","d3-voronoi":"^1.1.0","raf":"^3.3.0"},"gitHead":"49c24bd2ca7953cfa986991ee72e7e146b1c8291","_id":"premonish@1.0.3","_shasum":"307fc563c1048e11db609bb466c6707484f9ce1a","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.0","_npmUser":{"name":"mathisonian","email":"mc@mathisonian.com"},"dist":{"shasum":"307fc563c1048e11db609bb466c6707484f9ce1a","tarball":"https://registry.npmjs.org/premonish/-/premonish-1.0.3.tgz","integrity":"sha512-RwZCSgizjvlTUp/4jdFQ6ZmgLuea09Fmd2P7zAm9n5GvlK2ao/YyjRR9s6WP6WBbD/jTGIO6/X22jh2Ivoxe5g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEAqGaHgSpG1GZ1hRtmCrJEUfAOo7dHQ0y4JR0NJYvLHAiEAm7S5SNCpIZ3c/FQE/6dv4Srb8uLKaVuSdGSH6OhK6qM="}]},"maintainers":[{"name":"mathisonian","email":"mc@mathisonian.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/premonish-1.0.3.tgz_1480703511137_0.8058251105248928"}},"1.0.4":{"name":"premonish","version":"1.0.4","description":"Predict which DOM element a user will interact with next.","main":"lib/index.js","scripts":{"example":"budo examples/debug.js --live -o -- -t [ babelify --presets [ es2015 ] ] -t browserify-css","build":"babel src --out-dir lib","build-gh-pages":"browserify examples/debug.js -t [ babelify --presets [ es2015 ] ] -t browserify-css | indexhtmlify | metadataify --title \"premonish\" > ../gh-pages/premonish/index.html","test":"semistandard src/** test/** && mocha --compilers js:babel-core/register","syntax-fix":"semistandard --fix"},"repository":{"type":"git","url":"git+https://github.com/mathisonian/premonish.git"},"keywords":["prediction","optimization","preload"],"author":{"name":"Matthew Conlen"},"license":"MIT","bugs":{"url":"https://github.com/mathisonian/premonish/issues"},"homepage":"https://github.com/mathisonian/premonish#readme","devDependencies":{"babel-cli":"^6.18.0","babel-preset-es2015":"^6.18.0","babelify":"^7.3.0","browserify-css":"^0.9.2","budo":"^9.2.2","d3-selection":"^1.0.3","d3-transition":"^1.0.3","expect":"^1.20.2","indexhtmlify":"^1.3.1","metadataify":"^1.0.2","mocha":"^3.2.0","semistandard":"^9.1.0"},"dependencies":{"curve-store":"^1.1.2","d3-voronoi":"^1.1.0","raf":"^3.3.0"},"gitHead":"f913a98ae4cc634f395c90de91384f454decb15d","_id":"premonish@1.0.4","_shasum":"213741050837b34786536dde50f065023f4bc07a","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"mathisonian","email":"mc@mathisonian.com"},"dist":{"shasum":"213741050837b34786536dde50f065023f4bc07a","tarball":"https://registry.npmjs.org/premonish/-/premonish-1.0.4.tgz","integrity":"sha512-cLe/HkMryI4l9S98OWGT7nYe9N1KJ7VZoMg4PdwH7gDy1gH2wV7vZMxUimooSnW5qXMvYc3tbVdd8Y3mXMXydQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEIIRSlNUxicJuZjyKWyEBVKDXb2IewCAQc9KYvVe7miAiEApGVi5pog7y0MtQrmBYktoQv8m5dgMYnWMBqMKZ/eEQo="}]},"maintainers":[{"name":"mathisonian","email":"mc@mathisonian.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/premonish-1.0.4.tgz_1480971639872_0.10521896928548813"}}},"readme":"# premonish\nPredict which DOM element a user will interact with next.\n\n[View the demo](https://mathisonian.github.io/premonish/)\n\n## About\n\n#### What does it do?\n\nYou give it a list of elements and it will try to predict when a user is about to mouse over one of those elements.\n\n#### How does it work?\n\nIt's pretty naive, it just looks at the velocity and position of the mouse and tries to find the element that you are probably\nmoving towards based on that.\n\n#### Is it just a voronoi?\n\nIt uses a voronoi under the hood, but instead if looking at current mouse position it looks at expected mouse position. In my\ntesting this seems strictly better than the voronoi / bubble cursor technique.\n\n#### Why do I want this?\n\nYou could use it to perform some optimizations, maybe similar to [instantclick](http://instantclick.io/).\n\n#### Whats with the name?\n\nThe library has these premonitions, but they aren't always right.\n\n## Installation\n\n```\n$ npm install premonish\n```\n\n## Usage\n\n```js\nimport Premonish from 'premonish';\nconst premonish = new Premonish({\n  selectors: ['a', '.list-of' '.selectors', '.to', '#watch'],\n  elements: [] // Alternatively, provide a list of DOM elements to watch\n});\n\npremonish.onIntent(({el, confidence}) => {\n  console.log(el); // The DOM node we suspect the user is about to interact with.\n  console.log(confidence); // How confident are we about the user's intention? Scale 0-1\n});\n```\n\n## API\n\n### Initialization\n\n```js\nvar premonish = new Premonish({\n  selectors: [], // list of selectors\n  elements: [] // A list of DOM elements\n});\n```\n\nAt least one of `selectors` or `elements` is required.\n\n### Predicting interaction\n\nThe `onIntent` callback will be called when `premonish` thinks that a user is likely going to interact with\none of the watched elements.\n\n```js\npremonish.onIntent(({el, confidence}) => {\n  // el is the expected DOM element\n  // confidence is a score from 0-1 on how confident we are in this prediction.\n});\n```\n\n### More information\n\nThe `onMouseMove` callback allows users to look at some of the internal calculations that `premonish` is making.\n\n```js\npremonish.onMouseMove(({ position, velocity, expected }) => {\n  // Each value is an object { x: number, y: number }.\n  // `expected` is the approximate point premonish thinks the\n  // user is moving the mouse to.\n});\n```\n\n### Stop watching\n\nCall `stop()` when you are done using the library to cleanup the events it is using.\n\n```js\npremonish.stop();\n```\n\n## Author\n\nMatthew Conlen (github@mathisonian.com)\n\n## LICENSE\n\nMIT\n","maintainers":[{"name":"mathisonian","email":"mc@mathisonian.com"}],"time":{"modified":"2022-06-24T14:14:59.042Z","created":"2016-12-02T03:12:20.313Z","1.0.1":"2016-12-02T03:12:20.313Z","1.0.2":"2016-12-02T03:13:27.886Z","1.0.3":"2016-12-02T18:31:51.741Z","1.0.4":"2016-12-05T21:00:40.109Z"},"homepage":"https://github.com/mathisonian/premonish#readme","keywords":["prediction","optimization","preload"],"repository":{"type":"git","url":"git+https://github.com/mathisonian/premonish.git"},"author":{"name":"Matthew Conlen"},"bugs":{"url":"https://github.com/mathisonian/premonish/issues"},"license":"MIT","readmeFilename":"README.md"}