{"_id":"@coglabuzh/webpsy.js","_rev":"6-ea7744d69379b29e328d9df4f7bbb748","name":"@coglabuzh/webpsy.js","dist-tags":{"latest":"1.1.5"},"versions":{"1.0.0":{"name":"@coglabuzh/webpsy.js","version":"1.0.0","description":"Free to use online library for programming of psychological online experiments - the JavaScript library tailored to elevate your psychological studies in the digital realm! 🚀 From academics, for academics.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"ISC","dependencies":{"lit":"^2.7.6"},"_id":"@coglabuzh/webpsy.js@1.0.0","gitHead":"d3053ee929ff25e80f1e9b550e90062a2e8fff4a","_nodeVersion":"20.5.0","_npmVersion":"9.8.0","dist":{"integrity":"sha512-n/yAJ6iMfIWsuuHDJ70EBqniLS0Hj/MAop5Ue+oi7MvPzRg8Hlhjwhwxb7Sq/P+4vcs3b4XGVr0QCklJTA48yg==","shasum":"20f0e0214772e4aaaffcaf624e3184222e5e6233","tarball":"https://registry.npmjs.org/@coglabuzh/webpsy.js/-/webpsy.js-1.0.0.tgz","fileCount":16,"unpackedSize":4090071,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8hUhOqmP216bokX5L2bxzgFzmY4/Cw/ihLl2lgzyL6QIgdOzBWxhvFwQqZP+TnMfubqkLuzO4Kmec73c+Xo8z82Y="}]},"_npmUser":{"name":"ajit283","email":"mail@a-mistry.com"},"directories":{},"maintainers":[{"name":"ajit283","email":"mail@a-mistry.com"},{"name":"hdames","email":"hannah.dames@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpsy.js_1.0.0_1692569963374_0.30629468109877633"},"_hasShrinkwrap":false},"1.1.0":{"name":"@coglabuzh/webpsy.js","version":"1.1.0","description":"Free to use online library for programming of psychological online experiments - the JavaScript library tailored to elevate your psychological studies in the digital realm! 🚀 From academics, for academics.","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"jest","dev":"tsc --watch","build":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/jest":"^29.5.3","jest":"^29.6.3","tailwindcss":"^3.3.3","ts-jest":"^29.1.1","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"},"dependencies":{"lit":"^2.8.0"},"_id":"@coglabuzh/webpsy.js@1.1.0","gitHead":"7479cd97440ba99411061bd15c44db99591e8a4c","_nodeVersion":"20.5.0","_npmVersion":"9.8.0","dist":{"integrity":"sha512-0bMtVGSUhGLm2D1gIqzL6WgitoViLMkIJC9s548RyI7po0zgXc97C0dePW77NK1FQExuKlEwuzu8QeNHSA+Psw==","shasum":"46e3b4930db02e5c5c7d96e20eb9ac1b7fa648b3","tarball":"https://registry.npmjs.org/@coglabuzh/webpsy.js/-/webpsy.js-1.1.0.tgz","fileCount":49,"unpackedSize":5448561,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEVBXzRGEMwjP5Bhk52qoKe0Mvv9l5RSOvgqxvcTsT8KAiA11zudDER24kcH41C4lPRzQZs7+X7l0Ey2sthQlB/KFg=="}]},"_npmUser":{"name":"ajit283","email":"mail@a-mistry.com"},"directories":{},"maintainers":[{"name":"ajit283","email":"mail@a-mistry.com"},{"name":"hdames","email":"hannah.dames@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpsy.js_1.1.0_1697470001009_0.19828720100859543"},"_hasShrinkwrap":false},"1.1.1":{"name":"@coglabuzh/webpsy.js","version":"1.1.1","description":"Free to use online library for programming of psychological online experiments - the JavaScript library tailored to elevate your psychological studies in the digital realm! 🚀 From academics, for academics.","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"jest","dev":"tsc --watch","build":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/jest":"^29.5.3","jest":"^29.6.3","tailwindcss":"^3.3.3","ts-jest":"^29.1.1","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"},"dependencies":{"@coglabuzh/webpsy.js":"^1.1.0","jspsych":"^7.3.3","lit":"^2.8.0","sweetalert2":"^11.7.32"},"_id":"@coglabuzh/webpsy.js@1.1.1","gitHead":"c888a7754cb18898d9cc26550feea8887bbfce92","_nodeVersion":"21.0.0","_npmVersion":"10.2.0","dist":{"integrity":"sha512-tl0xlB9DA6R+mmSi0XeS+rFy7NpyftoHxr1wyozW/NUdb53DfZ2p/BeZZgv4plIJRzl5mM0xGz3SS4ywORvZjg==","shasum":"bea43c3d475192c4948cffafbdd9669d4145430c","tarball":"https://registry.npmjs.org/@coglabuzh/webpsy.js/-/webpsy.js-1.1.1.tgz","fileCount":86,"unpackedSize":6254125,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDc/bcOrYg/AE0agXCV2O4Zcu7Lj9GPmqFa9aFw06shOAIgBkz3qRvgRXkJKNhHuX28hOn0EVS1pe5oeeQF5a5KTfg="}]},"_npmUser":{"name":"ajit283","email":"mail@a-mistry.com"},"directories":{},"maintainers":[{"name":"ajit283","email":"mail@a-mistry.com"},{"name":"hdames","email":"hannah.dames@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpsy.js_1.1.1_1698805884504_0.0764175927755053"},"_hasShrinkwrap":false},"1.1.2":{"name":"@coglabuzh/webpsy.js","version":"1.1.2","description":"Free to use online library for programming of psychological online experiments - the JavaScript library tailored to elevate your psychological studies in the digital realm! 🚀 From academics, for academics.","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"jest","dev":"tsc --watch","build":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/jest":"^29.5.3","jest":"^29.6.3","tailwindcss":"^3.3.3","ts-jest":"^29.1.1","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"},"dependencies":{"@coglabuzh/webpsy.js":"^1.1.0","jspsych":"^7.3.3","lit":"^2.8.0","sweetalert2":"^11.7.32"},"_id":"@coglabuzh/webpsy.js@1.1.2","gitHead":"c4b99c022e452878a622ac60f5e182ddad96b2ab","_nodeVersion":"21.0.0","_npmVersion":"10.2.0","dist":{"integrity":"sha512-3epEvWfCFm+cG6FpgmFJCutIsSVy71HnJHCq5rt/Js5XDt8RdTFUFTzH7AE6zbzTJXuXrnCMD14l34vXVA8ZkA==","shasum":"b7b3880d77de9cf49743d063dd083b44fc880e5c","tarball":"https://registry.npmjs.org/@coglabuzh/webpsy.js/-/webpsy.js-1.1.2.tgz","fileCount":134,"unpackedSize":6328090,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcpyeEL8FydppZ+5qcy8M4AEM5jqtKqx63d6lhskSzGQIgbEV7BjPz6DkpK6c16vZQpKhAct2In3X8WrP0ytcKarU="}]},"_npmUser":{"name":"ajit283","email":"mail@a-mistry.com"},"directories":{},"maintainers":[{"name":"ajit283","email":"mail@a-mistry.com"},{"name":"hdames","email":"hannah.dames@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpsy.js_1.1.2_1698806131733_0.32067517652935984"},"_hasShrinkwrap":false},"1.1.3":{"name":"@coglabuzh/webpsy.js","version":"1.1.3","description":"Free to use online library for programming of psychological online experiments - the JavaScript library tailored to elevate your psychological studies in the digital realm! 🚀 From academics, for academics.","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"jest","dev":"tsc --watch","build":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/jest":"^29.5.3","jest":"^29.6.3","tailwindcss":"^3.3.3","ts-jest":"^29.1.1","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"},"dependencies":{"@coglabuzh/webpsy.js":"^1.1.0","jspsych":"^7.3.3","lit":"^2.8.0","sweetalert2":"^11.7.32"},"_id":"@coglabuzh/webpsy.js@1.1.3","gitHead":"ca5d0dcded7d5a41ab92f9a6000c25d400afea28","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-il8/rPpIlBZnLXamMJau2oVlDn8UlciO0xxRms9/NOG4u9Hk4ip6hno3oui1mP/T1+FZj8jLsi50npy1Jalfng==","shasum":"7f1435f9ffb39a341dec6c96161fe24e58582788","tarball":"https://registry.npmjs.org/@coglabuzh/webpsy.js/-/webpsy.js-1.1.3.tgz","fileCount":86,"unpackedSize":6254356,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDaqiTi8PWryu+O8758UHENmIvo733F5uoa3WiEnxBWSAiBMoRPLZcT+Z/o08Q1q6PwPnWg3XHGLcB+xDBJ1AGIaKg=="}]},"_npmUser":{"name":"ajit283","email":"mail@a-mistry.com"},"directories":{},"maintainers":[{"name":"ajit283","email":"mail@a-mistry.com"},{"name":"hdames","email":"hannah.dames@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpsy.js_1.1.3_1698929196903_0.29955768141206995"},"_hasShrinkwrap":false},"1.1.4":{"name":"@coglabuzh/webpsy.js","version":"1.1.4","description":"Free to use online library for programming of psychological online experiments - the JavaScript library tailored to elevate your psychological studies in the digital realm! 🚀 From academics, for academics.","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"jest","dev":"tsc --watch","build":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/jest":"^29.5.3","jest":"^29.6.3","tailwindcss":"^3.3.3","ts-jest":"^29.1.1","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"},"dependencies":{"@coglabuzh/webpsy.js":"^1.1.0","jspsych":"^7.3.3","lit":"^2.8.0","sweetalert2":"^11.7.32"},"_id":"@coglabuzh/webpsy.js@1.1.4","gitHead":"a8ce4f8b104067f9fa2c13add8579673b40ae14a","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-gO5F1/7wmg0BVOJdAbX+RKSH2PX5u8qERAMGV5Dve+b3h6xv48pfCwZjh9VMoVT5KMSl+vXiZ8efg7RJFIuFpQ==","shasum":"9c8211ff09af6b7fa201a2be5b65a35d055120be","tarball":"https://registry.npmjs.org/@coglabuzh/webpsy.js/-/webpsy.js-1.1.4.tgz","fileCount":87,"unpackedSize":6258601,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDkudLY2HCJShklVhy6tdR4+AJzQsq4mbsn3Sn0NwewUgIgfh9IsqVIPzslY3+6yP5RT6E+d4YH5vQvSN+FzxR2Um0="}]},"_npmUser":{"name":"ajit283","email":"mail@a-mistry.com"},"directories":{},"maintainers":[{"name":"ajit283","email":"mail@a-mistry.com"},{"name":"hdames","email":"hannah.dames@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpsy.js_1.1.4_1699466302877_0.9774362538086618"},"_hasShrinkwrap":false},"1.1.5":{"name":"@coglabuzh/webpsy.js","version":"1.1.5","description":"Free to use online library for programming of psychological online experiments - the JavaScript library tailored to elevate your psychological studies in the digital realm! 🚀 From academics, for academics.","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"jest","dev":"tsc --watch","build":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/jest":"^29.5.3","jest":"^29.6.3","tailwindcss":"^3.3.3","ts-jest":"^29.1.1","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"},"dependencies":{"@coglabuzh/webpsy.js":"^1.1.0","jspsych":"^7.3.3","lit":"^2.8.0","sweetalert2":"^11.7.32"},"_id":"@coglabuzh/webpsy.js@1.1.5","gitHead":"fd86661d613d6de9e5331764e6220f95da2d3fe5","_nodeVersion":"21.2.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-sbd7Kn8lgjIwG9LcS4Ie7BsFWHXQ1w7Issey2KYKgoqKYEaVXqe1esx9TSAdyBg60AMly12TLohGVCkgGT0rbg==","shasum":"07199a23362f958df795ad67f20f7c5351802808","tarball":"https://registry.npmjs.org/@coglabuzh/webpsy.js/-/webpsy.js-1.1.5.tgz","fileCount":137,"unpackedSize":6337660,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbp1+dXT/jvbsMryg50pB++cYJ3JC9ZfCh2HNaxpB8WwIhAKEFTvTqVNAXySYSVNhZgsi2aJp0hN24JFY69qk9BVwT"}]},"_npmUser":{"name":"ajit283","email":"mail@a-mistry.com"},"directories":{},"maintainers":[{"name":"ajit283","email":"mail@a-mistry.com"},{"name":"hdames","email":"hannah.dames@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpsy.js_1.1.5_1700747280982_0.20539265140080576"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-20T22:19:23.258Z","1.0.0":"2023-08-20T22:19:23.607Z","modified":"2023-11-23T13:48:01.529Z","1.1.0":"2023-10-16T15:26:41.342Z","1.1.1":"2023-11-01T02:31:24.856Z","1.1.2":"2023-11-01T02:35:32.139Z","1.1.3":"2023-11-02T12:46:37.274Z","1.1.4":"2023-11-08T17:58:23.047Z","1.1.5":"2023-11-23T13:48:01.252Z"},"maintainers":[{"name":"ajit283","email":"mail@a-mistry.com"},{"name":"hdames","email":"hannah.dames@outlook.com"}],"description":"Free to use online library for programming of psychological online experiments - the JavaScript library tailored to elevate your psychological studies in the digital realm! 🚀 From academics, for academics.","license":"ISC","readme":"# 🌐 WebPsy.js 🧠\n\nFree to use online library for programming of psychological online experiments - the JavaScript library tailored to elevate your psychological studies in the digital realm! 🚀 From academics, for academics.\n\nWhether you're a curious psychologist, a dedicated researcher, or a tech-savvy cognitive scientist, _WebPsy.js_ is your indispensable toolkit for designing and conducting seamless web-based psychological experiments, with a particular focus on harnessing the power of jsPsych.\n\n\n## Contributions and Feedback\n\nContributions and feedback are welcome; have a look at `CONTRIBUTING.md` for more information.\n\n## How to use\n\nFirst, create an experiment. The best way to do this is to clone the coglabuzh/jspsych-template repository, as it provides a good starting point. Remember to run `npm i` in the root of the experiment to install the necessary dependencies. Then, run `npm i @coglabuzh/webpsy.js` to install the production version of this library. Now, you can import the functions and types described below by including this at the top of any .ts/.js file:\n\n```typescript\nimport { colorPicker, coloredGraphic } from \"@coglabuzh/webpsy.js\";\n```\n\n## Stimuli\n\nThese are functions that return HTML as a string. They can be used in any jsPsych trial that has a `stimulus` field. \n\n### `listenLocation` / window object\n\nIn some cases, stimuli need to return certain values (e.g. the color chosen by the user in the color picker). In order to read these values, these results are written to an attribute of the window object. Which attribute this is depends on the trial and is noted in the documentation of each trial. Values can then be accessed like this, for example:\n\n```typescript\n\non_finish: (data: HtmlKeyboardResponseTrialData) => {\n      console.log(window[\"color_picker__result\"]);\n    },\n\n```\n\nCertain experiments can also \"listen\" to the value of another experiment. For example, the Colored Graphic can change its color as soon as the user picks a color in the color picker. For this, the Colored Graphic trial takes a `listenLocation` argument, where the name of the window attribute can be provided. \n\nA complete example for this is the `color-picker-with-graphic` example experiment.\n\n\n\n### Stimuli functions\n\n#### Circle of Squares\n![Screenshot of stimulus](doc_assets/image.png)\n\nGenerates a number of squares laid out in a circle. Text or HTML can be placed inside the circle. If the user clicks on a square, its index (starting from 0) is written to `window.circle_of_squares__result`.\n\n#### Colored Graphic\n\n![Screenshot of stimulus](image.png)\n\nTakes a link to an svg file (in the `assets` folder of the experiment) and a color, then displays the SVG file in the specified color. The black areas of the original SVG file get colored in the specified color, e.g. this file is the source file of the screenshot above:\n\n![Source SVG file](image-1.png)\n\nThe stimulus can change color according to the `listenLocation`.\n\n#### Color Picker\n\n![Screenshot of stimulus](image-2.png)\n\nGenerates a color picker. The user can select any color through clicking on a certain position of the color wheel. An HTML string can be provided that should be rendered in the center of the color wheel can be provided. In the screenshot above, it is the Colored Graphic stimulus. The chosen color is written to `window.color_picker__result`.\n\n## Basic functions\n\nThese are functions that are needed frequently when creating experiments.\n\n### Function overview\n\n#### `chooseNElementsFromArray`\n\nChooses `n` elements from the given array randomly.\n\n#### `shuffleArray`\n\nReturns shuffled version of input array. Shuffles using Knuth's algorithm (an optimized version of the Fisher-Yates shuffle, see https://en.wikipedia.org/wiki/Fisher–Yates_shuffle)\n\n### Types\n\nAdds some much-needed types to jsPsych. Currently, we mostly provide types for the data generated by trials. If e.g. the `on_finish` function of an `HtmlKeyboardResponsePlugin` trial is annotated like this:\n\n```typescript\non_finish: (data: HtmlKeyboardResponseTrialData) => {\n      console.log(data.rt);\n      console.log(data.abc);\n    },\n\n```\n\nThe second `console.log` line would be red underlined in the editor since the compiler can now check whether this attribute actually exists in the generated data.\n","readmeFilename":"README.md"}