{"_id":"@8pattern/jevent","_rev":"5-aeb89a2de31a65d6dd188e4df03bdda3","name":"@8pattern/jevent","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@8pattern/jevent","version":"1.0.0","description":"a non-dependent library to achieve subscribe/publish partten for JS","scripts":{"dev":"webpack --mode=development","build":"webpack --mode=production","test":"jest"},"keywords":["subscribe/publish"],"author":{"name":"8th-pattern"},"license":"MIT","devDependencies":{"@babel/plugin-proposal-class-properties":"^7.5.5","@babel/plugin-proposal-object-rest-spread":"^7.5.5","@babel/preset-typescript":"^7.6.0","@types/jest":"^24.0.18","babel-loader":"^8.0.6","clean-webpack-plugin":"^3.0.0","jest":"^24.9.0","jest-cli":"^24.9.0","terser-webpack-plugin":"^2.1.0","ts-jest":"^24.1.0","typescript":"^3.6.3","webpack":"^4.40.2","webpack-cli":"^3.3.9"},"main":"./dist/jEvent.js","repository":{"type":"git","url":"git+https://github.com/8th-pattern/jEvent.git"},"bugs":{"url":"https://github.com/8th-pattern/jEvent/issues"},"homepage":"https://github.com/8th-pattern/jEvent#readme","_id":"@8pattern/jevent@1.0.0","_nodeVersion":"10.16.2","_npmVersion":"6.7.0","dist":{"integrity":"sha512-GC9A3jt/2VBX0rnpad4IW7m/Dkakz8uSBnmpcTrF2vXcId7+bEbZEX2f8RPDu3WvuvEwkxUwY9vl8at06ub6Eg==","shasum":"4281d3003f53c8013da0953f878aebb4a34a4b12","tarball":"https://registry.npmjs.org/@8pattern/jevent/-/jevent-1.0.0.tgz","fileCount":10,"unpackedSize":14853,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjDXPCRA9TVsSAnZWagAAugsQAILhNH3b6x7dyzjc8cw+\nRPNhC6TzjuL9nVYhDBYyQLXlsxKQdEXyv80EJ9A3H3p+PG9N9gH/9uKe3SHI\nBjAXBTPpReOizHUSY2A8VV7vXj8Ga+2LUKxh67/Ne9kJooIEkkV1ham+msgW\n0RjGmHl281scF+t4wGJWW1kOacNGvBLmP5DRWKl0rr/vST2Ks+ev74553/XJ\nh659AsuODNtiWof8fV1ICIuyMTjmZZ5jsnCAA4X/bjK6L8bo6AVK1BmYCtMb\nb5d621wcZWOonuIM+b4mTlji5LKJH54w4dua9vVMBVc2ZbEtOrOpx5Rqb0GB\n9xBiZU2OXit4FCXMwXG2A5okhZWK7LeYYyZQYw3oaAscwa6DfVITanRb1Tdr\nt6gIe99c89pe5IH99N1UKtCcUV5EG4DKCgUNl1Jg6FaHImWXGKaYIHqZ104v\nYBtPAU5XbimVl19lvt0dQfb5BvhPlxzTHEjSl50s9BH3PemLlLariquXJloq\no7KgvBWERuvOEQvVyLtmbrKIJckHp1JeSfB+XahVJC74zBbw+noVdHP/JMgO\n3EBTM6q1f9J3w3aqIEktSs9w1ikYUzJts+6yQgYogdThX7xIDy+TKOY+2Hpa\nRgdTqhQOK9iQDO8D2gNlot+UPCLNwz69GDW5Ro6rSs1DFxJc0pDawpTnEzn1\nqzz1\r\n=QMle\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCdVn2SHxV7ByT/v9REJ6JK0w6lvuaZfZrUaC+OHxaixQIhAJZsZhITCygPZ0hm3O7/lTKWs6O2HtoJ8ArtDXy2xj+l"}]},"maintainers":[{"name":"8pattern","email":"eighth.principle@gmail.com"}],"_npmUser":{"name":"8pattern","email":"eighth.principle@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jevent_1.0.0_1569469902383_0.45004024865686887"},"_hasShrinkwrap":false},"1.1.0":{"name":"@8pattern/jevent","version":"1.1.0","description":"a non-dependent library to achieve subscribe/publish partten for JS","scripts":{"dev":"webpack --mode=development","build":"webpack --mode=production","test":"jest"},"keywords":["subscribe/publish"],"author":{"name":"8th-pattern"},"license":"MIT","devDependencies":{"@babel/plugin-proposal-class-properties":"^7.5.5","@babel/plugin-proposal-object-rest-spread":"^7.5.5","@babel/preset-typescript":"^7.6.0","@types/jest":"^24.0.18","babel-loader":"^8.0.6","clean-webpack-plugin":"^3.0.0","jest":"^24.9.0","jest-cli":"^24.9.0","terser-webpack-plugin":"^2.1.0","ts-jest":"^24.1.0","typescript":"^3.6.3","webpack":"^4.40.2","webpack-cli":"^3.3.9"},"main":"./dist/jEvent.js","types":"./types/jEvent.d.ts","repository":{"type":"git","url":"git+https://github.com/8th-pattern/jEvent.git"},"bugs":{"url":"https://github.com/8th-pattern/jEvent/issues"},"homepage":"https://github.com/8th-pattern/jEvent#readme","gitHead":"468b073b25019728f302cc4a74c30119a7ec6110","_id":"@8pattern/jevent@1.1.0","_nodeVersion":"10.16.2","_npmVersion":"6.7.0","dist":{"integrity":"sha512-TZ9B7IMHFd9rbCHg+luPzeX/IZX8M6V8r/M04MpL5JUSjX5194tYXqgGgz1EYqMXSh76cTzfx8FyMxL/NzxdRQ==","shasum":"5a0af355b63251ccc09b03f53787654ca4910d0f","tarball":"https://registry.npmjs.org/@8pattern/jevent/-/jevent-1.1.0.tgz","fileCount":12,"unpackedSize":17601,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpTHCCRA9TVsSAnZWagAA7LAQAIJOG0fz5JYeifPbpc6E\nXKThdT2bQIXrV/q1j9O71nwYhsa46heD9HhhIaI47S4zAEaDCCLnleCRP4hs\np6Syjk2edrRbm4s7L+AVNLLcfzDb5UbOud5w2YT3S1YsdcF7wIuibyDkjvFe\nxmwuCD17BiRMGOSH/8Kp0wEA+EcEoHYTFWjxz4LHg3hMnTngKMkU5mACNWLA\nyrO5ue/6NyaWOTvHN16Nrpp/03w10drofQTBcWi5stlNIHVV5FCzGF4shfqC\nrPnMmGlrg0iUAoVuGOeazIO2ZcN42sGDGRxITS3Rc7JEgqM+GBWE0PkZ/Xw7\nJJjUaWnDmnfA9Ua5p5BZhhja6vdPGkxcVK/Rrej29a5gYfoklP0Bws9tG616\nu9GAoyduHJ6PhogrmGQgPubnYl8GNG6hGnHIBfM6jK7KPTs1UuT2S2I9tE7H\ndd8I3iS/KlwOwRIynxPnR7YU3sI9XcGmEyl14lAm5ZHiF6UOrApO0OVcWWSp\nAp2St6IG6DhtQCAaFlrApx3oiHWwsNc8F+x0qr/twKfP7V/TZ3qP3t17jgWS\nDCUyH/alpCeF6LrXfA++zvABdERKPBFNOdaiUnjygq3agc7PVU+hsusx5ZrL\nmUuL9Nau0EI3B8/wbmtDwjm6hJALCUrQLtEm2/NNEqz7cXcIm2oXikYNlkkb\nA91t\r\n=8U8V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFeL34P2SfJcDMAf6QfULmZpGeGGV9oTkLez8QGEtGMmAiBb/seNGe2cnc2cDl3VBZTcyijFeX9RSQ4PXSm1UoFYag=="}]},"maintainers":[{"name":"8pattern","email":"eighth.principle@gmail.com"}],"_npmUser":{"name":"8pattern","email":"eighth.principle@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jevent_1.1.0_1571107265967_0.0076012721133034145"},"_hasShrinkwrap":false},"1.2.0":{"name":"@8pattern/jevent","version":"1.2.0","description":"a zero-dependent library accomplishing the subscribe/publish partten for JavaScript & TypeScript","scripts":{"dev":"rollup -c -w --environment NODE_ENV:development","build":"rollup -c --environment NODE_ENV:production","test":"jest"},"keywords":["subscribe/publish"],"author":{"name":"8th-pattern"},"license":"MIT","main":"./dist/jEvent.js","types":"./src","devDependencies":{"@babel/plugin-proposal-object-rest-spread":"^7.5.5","@babel/preset-typescript":"^7.6.0","@types/jest":"^24.0.18","babel-loader":"^8.0.6","jest":"^24.9.0","jest-cli":"^24.9.0","rollup":"^1.26.3","rollup-plugin-babel":"^4.3.3","rollup-plugin-terser":"^5.1.2","rollup-plugin-typescript2":"^0.24.3","ts-jest":"^24.1.0","typescript":"^3.6.3"},"repository":{"type":"git","url":"git+https://github.com/8th-pattern/jEvent.git"},"bugs":{"url":"https://github.com/8th-pattern/jEvent/issues"},"homepage":"https://github.com/8th-pattern/jEvent#readme","gitHead":"4fdfc825f6c54e80ce86b2d46357f729f324a607","_id":"@8pattern/jevent@1.2.0","_npmVersion":"6.5.0-next.0","_nodeVersion":"11.6.0","_npmUser":{"name":"8pattern","email":"eighth.principle@gmail.com"},"dist":{"integrity":"sha512-7v0ueJzqDeQYu5+YP0w+m6ePklBm3puW2z4DEab2ItryanQQLVWmkU4zX9Bg2lNnykbZnNHi1CVaGRJgPNGhxA==","shasum":"49cc843d7026f35122d966b132a400620a17ea91","tarball":"https://registry.npmjs.org/@8pattern/jevent/-/jevent-1.2.0.tgz","fileCount":13,"unpackedSize":14930,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe3RY3CRA9TVsSAnZWagAAKEEP/j93GXMkEkbCbAQRPQSh\nr0/lIyrGHVRMPp5dQtOBqRSFUDcZLjA9luaYo83HGbMNcCBZq/YLHyXAZQ33\nnkUW06p/hx+iv2MQe/3JxVBp7YJ78PO34MN8QN4s78UKCU0z+bNWrJDzjGhI\nQ5MFqMvN5R6+rKU4LBdXK7AAlHepg3hj96GseMkm61P1tRM+cTSRu2+2jAeK\n3c9vEHs4YgI96P6iOQH2DMGPoMiCuCbhHvmbr0xByiAEk9DdAjo+y5BrqCB4\nZaoeSuvaWmpEDbbqW9x3UaHALh1qYUITwJFrqGXX8MpoBd0YKTNAh2kT5Ba3\n1NA4eDjoaRC2dnz5epAzT3Y7CF9V8s1YQKa4DmLwAO027myhbkIFfww4STU6\nKiXNVigm948tNTJz4GMI0pdywa82swVfpfXLyGHQ1Mdv8yDBUNRfSsnVaiFB\n2AWIrINYHpfDPcDJ4HaLSCgcFO9v5pgMGIgMVIh+hTqpKF0F3HHRmmNBVVd+\nUJz0VOZs8BxYOJMd5EA1RK5nuFUGU00t3Y2FvacnWHxMzuf9wYR/6veq+M9D\nvuo9lYAblG7NTc3y2/Lszl55b3QMvqSRCLFajKTO2P26FedySjQMfIp/dkyn\n4lxTcfMo/TRW9jR/QroHvQ8yzAsD5f3+E4DpFKuqeUdimZIHsCG95FapppmE\n07X7\r\n=I+2F\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAjBGm+hxQRKKkkIfsq+7BoEgXClRbAIuiC3GZht/VMtAiEAq8gmKjb+d5Ck8Xg/tVH8aA/E3ntJWkMZAbkuHI/JQko="}]},"maintainers":[{"name":"8pattern","email":"eighth.principle@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jevent_1.2.0_1591547446906_0.9944491310992671"},"_hasShrinkwrap":false}},"time":{"created":"2019-09-26T03:51:42.151Z","1.0.0":"2019-09-26T03:51:42.523Z","modified":"2022-04-04T10:50:07.727Z","1.0.1":"2019-10-09T07:36:52.327Z","1.1.0":"2019-10-15T02:41:06.115Z","1.2.0":"2020-06-07T16:30:47.203Z"},"maintainers":[{"name":"8pattern","email":"eighth.principle@gmail.com"}],"description":"a zero-dependent library accomplishing the subscribe/publish partten for JavaScript & TypeScript","homepage":"https://github.com/8th-pattern/jEvent#readme","keywords":["subscribe/publish"],"repository":{"type":"git","url":"git+https://github.com/8th-pattern/jEvent.git"},"author":{"name":"8th-pattern"},"bugs":{"url":"https://github.com/8th-pattern/jEvent/issues"},"license":"MIT","readme":"## Installation\n\n```node\nnpm install @8pattern/jevent\n```\n\n\n## Usage\n\nThere are three methods to use jEvent:\n\n### Bind a object \n> Suitable when you want to isolate events of different targets\n\n```javascript\nimport jEvent from '@8pattern/jevent'\n\nconst tareget = document.body\nconst handle = () => {}\n\n// suscribe\njEvent(target).on('eventName', handle)\njEvent(target).on(['event1', 'event2'], handle)\n\n// publish\njEvent(target).emit('eventName', ['arg1', 'arg2'])\njEvent(target).emit(['event1', 'event2'])\n\n// off\n// the return value indicates whether the handle was removed\njEvent(target).off('eventName', handle)\n\n// clear\n// the return value indicates whether the event was removed\njEvent(target).clear('eventName')\n```\n\n### As a variable\n> If you want a global event channel, try it\n\n```javascript\nimport jEvent from '@8pattern/jevent'\n\nconst handle = () => {}\njEvent.on('eventName', handle)\njEvent.emit('eventName')\njEvent.off('eventName', handle)\njEvent.clear('eventName')\n```\n\nIn fact, if *no object*  binding, jEvent will binding a default **global object**. In other words, the usage is the sugar of the following statements.\n\n```javascript\nimport jEvent from '@8pattern/jevent'\n\nconst handle = () => {}\njEvent().on('eventName', handle)\njEvent().emit('eventName')\njEvent().off('eventName', handle)\njEvent().clear('eventName')\n```\n\n### As a class\n\n> Be aware that the imported module is a named one\n\n```javascript\nimport { JEvent } from '@8pattern/jevent'\n\nconst jEvent = new JEvent()\n\nconst handle = () => {}\njEvent.on('eventName', handle)\njEvent.emit('eventName')\njEvent.off('eventName', handle)\njEvent.clear('eventName')\n```\n\n> The method is **effective** if you want achieve a event bus on a class\n```javascript\nimport { JEvent } from '@8pattern/jevent'\n\nclass MyClass extends JEvent {\n    // some codes\n}\n\nconst myInstance = new MyClass()\n\nconst handle = () => {}\nmyInstance.on('eventName', handle)\nmyInstance.emit('eventName')\nmyInstance.off('eventName', handle)\nmyInstance.clear('eventName')\n```\n","readmeFilename":"README.md"}