{"_id":"@2jo4u4/easytools","_rev":"3-339018bf258c1afa6e7517b6485b111b","name":"@2jo4u4/easytools","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@2jo4u4/easytools","version":"1.0.0","keywords":[],"author":{"name":"jay.huang"},"license":"ISC","_id":"@2jo4u4/easytools@1.0.0","maintainers":[{"name":"2jo4u4","email":"2jo4u4@gmail.com"}],"umd":"dist/umd/index.js","dist":{"shasum":"3ecd0ec81f5a7cf46da01775b9fd76659294dc00","tarball":"https://registry.npmjs.org/@2jo4u4/easytools/-/easytools-1.0.0.tgz","fileCount":7,"integrity":"sha512-xikNHOqqVv71/EdqCx+pZ4SFMEqizdrIpo4kpbCzAU9FTvbcj6JV0xcrvm6z5s1a9YovpGL6D9DPBw3upkyHPw==","signatures":[{"sig":"MEUCIDwNpH2+1tSP4GpguQFMoFiGye6mfYwmhtju0nNHlbpmAiEAgBRAznp30b/USzSHyV1CFN4fXXeujhT0ijcJx+Ei050=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32349},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"2f9be1f7b321bdffb1365f6a5b5377d64128fb53","scripts":{"build":"rm -rf ./dist/* && rollup -c"},"_npmUser":{"name":"2jo4u4","email":"2jo4u4@gmail.com"},"_npmVersion":"10.8.2","description":"","directories":{},"_nodeVersion":"20.19.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.8.1","rollup":"^4.35.0","ts-node":"^10.9.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","rollup-plugin-dts":"^6.1.1","@babel/preset-react":"^7.26.3","@rollup/plugin-babel":"^6.0.4","@rollup/plugin-terser":"^0.4.4","@babel/preset-typescript":"^7.26.0","@rollup/plugin-typescript":"^12.1.2","@rollup/plugin-node-resolve":"^16.0.1","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"rxjs":"^7.8.2"},"_npmOperationalInternal":{"tmp":"tmp/easytools_1.0.0_1742971498520_0.9480517721320993","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@2jo4u4/easytools","version":"1.0.1","keywords":[],"author":{"name":"jay.huang"},"license":"MIT","_id":"@2jo4u4/easytools@1.0.1","maintainers":[{"name":"2jo4u4","email":"2jo4u4@gmail.com"}],"homepage":"https://github.com/2jo4u4/EasyTools","bugs":{"url":"https://github.com/2jo4u4/EasyTools/issues"},"umd":"dist/umd/index.js","dist":{"shasum":"b0eb1dd839693059da4adc10f19d43af5ae1864e","tarball":"https://registry.npmjs.org/@2jo4u4/easytools/-/easytools-1.0.1.tgz","fileCount":8,"integrity":"sha512-YQk7Ik5sICiAWoetmpnK1y+ijSPZpaa/LPUNH6ZkwOR+zJoZ1OIzEPk1ph9nCPw57ukCAR6kxsoeMmdkD+UmxA==","signatures":[{"sig":"MEUCIQDyWXFC5M72mjk57eXLP3Z3VwDgdC45P58oI0vmC9LW9AIgCvgmPfaJhfe5a8Pq3e2Rio3AWOfxQP4NBnADdi0aKPw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33771},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","gitHead":"e7b5b886f952382aac4d3f3b13ef5b78386db65b","scripts":{"build":"rm -rf ./dist/* && rollup -c"},"_npmUser":{"name":"2jo4u4","email":"2jo4u4@gmail.com"},"repository":{"url":"git+https://github.com/2jo4u4/EasyTools.git","type":"git"},"_npmVersion":"10.8.2","description":"provides some tools","directories":{},"_nodeVersion":"20.19.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.8.1","rollup":"^4.35.0","ts-node":"^10.9.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","rollup-plugin-dts":"^6.1.1","@babel/preset-react":"^7.26.3","@rollup/plugin-babel":"^6.0.4","@rollup/plugin-terser":"^0.4.4","@babel/preset-typescript":"^7.26.0","@rollup/plugin-typescript":"^12.1.2","@rollup/plugin-node-resolve":"^16.0.1","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"rxjs":"^7.8.2"},"_npmOperationalInternal":{"tmp":"tmp/easytools_1.0.1_1742974385777_0.11448555244248348","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@2jo4u4/easytools","version":"1.0.2","main":"dist/cjs/index.js","module":"dist/esm/index.js","umd":"dist/umd/index.js","types":"dist/types/index.d.ts","scripts":{"build":"rm -rf ./dist/* && rollup -c"},"keywords":[],"author":{"name":"Jay Huang"},"license":"MIT","description":"provides some tools","repository":{"type":"git","url":"git+https://github.com/2jo4u4/EasyTools.git"},"homepage":"https://github.com/2jo4u4/EasyTools","devDependencies":{"@babel/preset-react":"^7.26.3","@babel/preset-typescript":"^7.26.0","@rollup/plugin-babel":"^6.0.4","@rollup/plugin-node-resolve":"^16.0.1","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^12.1.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","rollup":"^4.35.0","rollup-plugin-dts":"^6.1.1","rollup-plugin-peer-deps-external":"^2.2.4","ts-node":"^10.9.2","tslib":"^2.8.1"},"peerDependencies":{"rxjs":"^7.8.2"},"_id":"@2jo4u4/easytools@1.0.2","gitHead":"36be2e9a373aa40241a1d3d3020522a17b5c46e2","bugs":{"url":"https://github.com/2jo4u4/EasyTools/issues"},"_nodeVersion":"20.19.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-IMYReqEBfg8+jIsvkGEBnZio/i+MuwRQXk4XN+r58jMF56SA+/cI55502Mv4wv47UwgvnoGAF99s5+bDEJErbg==","shasum":"0ef17cdc2975a273df527f2bad9628fa3e753552","tarball":"https://registry.npmjs.org/@2jo4u4/easytools/-/easytools-1.0.2.tgz","fileCount":8,"unpackedSize":36377,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD1icQME4qA2NQz6a4cXwY2fchXjQ8hmbm3lDdcEQm2nwIgEMzPDZKD2Bp9ToiU2ZFx9HAAynXcV3VnQ9wjCGMNm5o="}]},"_npmUser":{"name":"2jo4u4","email":"2jo4u4@gmail.com"},"directories":{},"maintainers":[{"name":"2jo4u4","email":"2jo4u4@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/easytools_1.0.2_1743058468756_0.806415709864917"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-26T06:44:58.413Z","modified":"2025-03-27T06:54:29.117Z","1.0.0":"2025-03-26T06:44:58.684Z","1.0.1":"2025-03-26T07:33:06.030Z","1.0.2":"2025-03-27T06:54:28.945Z"},"bugs":{"url":"https://github.com/2jo4u4/EasyTools/issues"},"author":{"name":"Jay Huang"},"license":"MIT","homepage":"https://github.com/2jo4u4/EasyTools","keywords":[],"repository":{"type":"git","url":"git+https://github.com/2jo4u4/EasyTools.git"},"description":"provides some tools","maintainers":[{"name":"2jo4u4","email":"2jo4u4@gmail.com"}],"readme":"# Feature\n\nThis project is simple and it wrap some web api.\n\n1. websocket\n1. media permissions\n\n---\n\n# Requirement\n\n1. [RxJS](https://rxjs.dev/) version >= v7.8.2\n\n---\n\n# Installation\n\n```sh\nnpm install @2jo4u4/easytools\n// or\nyarn add @2jo4u4/easytools\n```\n\n---\n\n# Feature\n\n1. Socket\n1. Media\n\n----\n\n## Socket Modules\n\n\nSocket class defindefinition\n\n|property name|desc|\n|--|--|\n|obsMessage|websocket event(only onmessage)|\n|obsEvents|websocket event and some custom event by project|\n\n|method name|desc|\n|--|--|\n|onSendMessage|send your message(if connection is not complete, it will queue your message, and send a custom event. finally connection is done and send all messages)|\n|onDestory|close connect and destory instance|\n\n> custom event by project:\n> 1. \"onGetInstance\": when your new a instance or auto retry\n> 1. \"onsend\": every time your exec \"onSendMessage\"(when socket connected)\n> 1. \"onqueue\": like \"onsend\" but it will trigger when connection isn't done.\n\n----\n\n## Media Modules\n\n|function name|desc|\n|--|--|\n|requestMediaStream|get device stream|\n|requestPermissions|get device permission|\n|whitenoise|generate a audio of 2 sec|\n|int16ToFloat32|transfer data|\n|float32ToInt16|transfer data|\n\n> PCM formation in JavaScript\n> We can use Int16Array to store\n\n> If you want to play audio\n> We neet to get AudioBuffer\n> AudioBuffer can use Float32Array to get\n\nPlease see [speech example](./example/speechManager.html)\n\nSpeechManager definition\n\n|property or method|desc|\n|--|--|\n|audioContext|[AudioContext](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext)|\n|addBuffer|add audio|\n|addBufferByFloat32|add audio by float32 array|\n|startSpeech|play audio, if playing and it won't work|\n|nextSpeech|stop current audio and play next|\n|stopSpeech|stop current audio and clean audio queue|\n\nMediaPermission definition\n|property or method|desc|\n|--|--|\n|obsState|obsever permission and notify|\n|requestMediaStream|get device stream|\n|requestPermissions|get device permission|\n\n---\n\n# ES modules Usage\n\nSome example\n\n```js\n\nimport { SpeechManager } from \"@2jo4u4/easytools\";\n\nconst audioContext = new AudioContext();\nconst speech = new SpeechManager(audioContext)\n\nconst inputField = document.querySelector(\"input\");\ninputField.onchange = function onchange() {\n    for (let index = 0; index < this.files.length; index++) {\n        const file = this.files[index];\n\n        const reader = new FileReader();\n\n        reader.onload = function (event) {\n        const arrayBuffer = event.target.result;\n        audioContext.decodeAudioData(arrayBuffer, function (audioBuffer) {\n            speech.addBuffer(audioBuffer);\n            const isSuccess = speech.startSpeech();\n        });\n        };\n        reader.readAsArrayBuffer(file);\n    }\n};\n\n```\n\n# More Example\n\n[See example folder](./example/)","readmeFilename":"README.md"}