{"_id":"2ch","_rev":"11-ea18d70a5dae1e9944ac351bdabc996b","name":"2ch","description":"A JavaScript library for comfortable 2ch watching.","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"2ch","description":"A JavaScript library for comfortable 2ch watching.","version":"0.1.0","homepage":"https://github.com/shiwano/2ch","author":{"name":"Shogo Iwano","email":"shiwano@gmail.com"},"repository":{"type":"git","url":"git://github.com/shiwano/2ch.git"},"bugs":{"url":"https://github.com/shiwano/2ch/issues"},"licenses":[{"type":"MIT","url":"https://github.com/shiwano/2ch/blob/master/LICENSE-MIT"}],"main":"lib/2ch","engines":{"node":">= 0.8.0"},"scripts":{"prepublish":"grunt coffee","test":"grunt test"},"dependencies":{"lodash":"~1.2.0","cheerio":"~0.11.0","iconv":"~2.0.6","superagent":"~0.14.6","encoding":"~0.1.6","moment":"~2.0.0","eventemitter2":"~0.4.11"},"devDependencies":{"grunt":"~0.4.1","grunt-cli":"~0.1.8","grunt-contrib-watch":"~0.4.3","grunt-contrib-coffee":"~0.7.0","grunt-simple-mocha":"~0.4.0","mocha":"~1.10.0","sinon":"~1.7.1","chai":"~1.6.0","sinon-chai":"~2.4.0","nock":"~0.18.2"},"peerDependencies":{"grunt":"~0.4.1"},"keywords":[],"readme":"# 2ch\nA JavaScript library for comfortable 2ch watching.\n\n## Getting Started\nInstall the module with: `npm install 2ch --save`\n\n```javascript\nvar watcher = new require('2ch').ThreadWatcher({\n  bbsName: 'iPhone',\n  query: /パズル＆ドラゴンズ/,\n});\nwatcher.on('update', function(messages) {\n  // do something.\n});\nwatcher.start();\n```\n\n## Documentation\n### Events\n#### update\nThe `update` event is emitted, when the watched thread has new messages.\nThe callback take the `messages` argument.\n\n```javascript\nwatcher.on('update', function(messages) {\n  messages.forEach(function(message) {\n    console.log(\n      message.number,\n      message.postedAt.format('YYYY/MM/DD HH:mm:ss'), // moment object.\n      message.name,\n      message.mail,\n      message.tripId,\n      message.body\n    );\n  });\n});\n```\n\n#### error\nThe `error` event is emitted, when a error occured in the library.\nThe callback take the `error` argument.\n\nIf there is no listener for it, then the default action is to print a stack trace and exit the program.\n\n#### reload\nThe `reload` event is emitted, when the watched thread is reloaded for deleting a message.\nThe callback take the `title` argument.\n\n#### begin\nThe `begin` event is emitted, when the watched thread is found.\nThe callback take the `title` argument.\n\n#### end\nThe `end` event is emitted, when the watched thread is ended.\nThe callback take the `title` argument.\n\n## Examples\n```javascript\nvar _2ch = require('2ch'),\n    ThreadWatcher = _2ch.ThreadWatcher,\n    BbsMenu = _2ch.BbsMenu;\n\nvar bbsMenu = new BbsMenu(); // common object\n\nvar watcher = new ThreadWatcher({\n  bbsName: '番組ch(NHK)',\n  query: /NHK総合を常に実況し続けるスレ/,\n  interval: 60000, // at least 5000\n  bbsMenu: bbsMenu\n});\n\nwatcher.on('update', function(messages) {\n  messages.forEach(function(message) {\n    console.log(message.number, message.rawString);\n  });\n});\n\nwatcher.on('error', function(error) {\n  console.log(error);\n});\n\nwatcher.on('begin', function(title) {\n  console.log(title, 'のスレッドが立てられました');\n});\n\nwatcher.on('end', function(title) {\n  console.log(title, 'のスレッドが終了しました');\n});\n\nwatcher.start();\n```\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/gruntjs/grunt).\n\n## TODO\n * Browserify\n\n## Release History\n * 2013-06-17   v0.1.0   First release.\n\n## License\nCopyright (c) 2013 Shogo Iwano\nLicensed under the MIT license.\n","readmeFilename":"README.md","_id":"2ch@0.1.0","dist":{"shasum":"62f3490245b1330d08b8926f730c28d5f08850e7","tarball":"https://registry.npmjs.org/2ch/-/2ch-0.1.0.tgz","integrity":"sha512-VcyRMCxoeTaXIGf2MYFc/cK2DFEHGt1DfOZjd0bypytkev6W0fZPMG14k4SdLX4iOYzVm3xf8SEMxcyAVj9VBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHkQaO+Sik1fMzTEB8CxRMpb8csQJcgbyFhamoSKIqbiAiEAw4f/NF1gbLM+OjdptaEYROC9vSBBETcjPm/74fjWNjs="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"shiwano","email":"shiwano@gmail.com"},"maintainers":[{"name":"shiwano","email":"shiwano@gmail.com"}]},"0.1.1":{"name":"2ch","description":"A JavaScript library for comfortable 2ch watching.","version":"0.1.1","homepage":"https://github.com/shiwano/2ch","author":{"name":"Shogo Iwano","email":"shiwano@gmail.com"},"repository":{"type":"git","url":"git://github.com/shiwano/2ch.git"},"bugs":{"url":"https://github.com/shiwano/2ch/issues"},"licenses":[{"type":"MIT","url":"https://github.com/shiwano/2ch/blob/master/LICENSE-MIT"}],"main":"lib/2ch","engines":{"node":">= 0.8.0"},"scripts":{"prepublish":"grunt coffee","test":"grunt test"},"dependencies":{"lodash":"~1.2.0","cheerio":"~0.11.0","iconv":"~2.0.6","superagent":"~0.14.6","encoding":"~0.1.6","moment":"~2.0.0","eventemitter2":"~0.4.11"},"devDependencies":{"grunt":"~0.4.1","grunt-cli":"~0.1.8","grunt-contrib-watch":"~0.4.3","grunt-contrib-coffee":"~0.7.0","grunt-simple-mocha":"~0.4.0","mocha":"~1.10.0","sinon":"~1.7.1","chai":"~1.6.0","sinon-chai":"~2.4.0","nock":"~0.18.2"},"peerDependencies":{"grunt":"~0.4.1"},"keywords":[],"readme":"# 2ch\nA JavaScript library for comfortable 2ch watching.\n\n## Getting Started\nInstall the module with: `npm install 2ch --save`\n\n```javascript\nvar watcher = new require('2ch').ThreadWatcher('iPhone', /パズル＆ドラゴンズ/);\nwatcher.on('update', function(messages) {\n  // do something.\n});\nwatcher.start();\n```\n\n## Documentation\n### Constructor arguments\n#### bbsName\nA string which is a valid board name in 2ch.\n\n#### query\nA string or RegExp which is used to find the watched thread.\n\n#### interval (default: 600000)\nA number determining the update interval. It is at least 5000.\n\n#### bbsMenu (default: null)\nA BbsMenu instance object. In most cases, there is no need to specify.\n\n### Methods\n#### start\nStart watching 2ch.\n\n#### stop\nStop watching 2ch.\n\n#### isWaching\nReturn `true`, when waching is started. Return `false`, otherwise.\n\n### Events\n#### update\nThe `update` event is emitted, when the watched thread has new messages.\nThe callback take the `messages` argument.\n\n```javascript\nwatcher.on('update', function(messages) {\n  messages.forEach(function(message) {\n    console.log(\n      message.number,\n      message.postedAt.format('YYYY/MM/DD HH:mm:ss'), // moment object.\n      message.name,\n      message.mail,\n      message.tripId,\n      message.body\n    );\n  });\n});\n```\n\n#### error\nThe `error` event is emitted, when a error occured in the library.\nThe callback take the `error` argument.\nIf there is no listener for it, then the default action is to print a stack trace and exit the program.\n\n#### reload\nThe `reload` event is emitted, when the watched thread is reloaded for deleting a message.\nThe callback take the `title` argument.\n\n#### begin\nThe `begin` event is emitted, when the watched thread is found.\nThe callback take the `title` argument.\n\n#### end\nThe `end` event is emitted, when the watched thread is ended.\nThe callback take the `title` argument.\n\n#### notfound\nThe `notfound` event is emitted, when the watched thread is not found by specified query.\n\n## Examples\n```javascript\nvar ThreadWatcher = require('../../lib/2ch').ThreadWatcher,\n    watcher = new ThreadWatcher('番組ch(NHK)', /NHK総合を常に実況し続けるスレ/, 5000),\n    loaded = false;\n\nwatcher.on('update', function(messages) {\n  if (!loaded) {\n    loaded = true;\n    return;\n  }\n  messages.forEach(function(message) {\n    console.log(\n      message.number,\n      message.name.replace(/<[^<>]+>/g, ''),\n      message.postedAt.format('YYYY/MM/DD HH:mm:ss'), // moment object.\n      message.tripId,\n      message.body.replace(/<[^<>]+>/g, '')\n    );\n  });\n});\n\nwatcher.on('error', function(error) {\n  console.log(error);\n  watcher.stop();\n});\n\nwatcher.on('reload', function(title) {\n  console.log(title, 'のスレッドが再読込されました');\n  loaded = false;\n});\n\nwatcher.on('begin', function(title) {\n  console.log(title, 'のスレッドが開始しました');\n});\n\nwatcher.on('end', function(title) {\n  console.log(title, 'のスレッドが終了しました');\n});\n\nwatcher.start();\n```\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/gruntjs/grunt).\n\n## TODO\n * Browserify\n\n## Release History\n * 2013-06-19   v0.1.1   Modified it.\n * 2013-06-17   v0.1.0   First release.\n\n## License\nCopyright (c) 2013 Shogo Iwano\nLicensed under the MIT license.\n","readmeFilename":"README.md","_id":"2ch@0.1.1","dist":{"shasum":"8202ad06daa8aa88634a5b9bad8eecf36487a20f","tarball":"https://registry.npmjs.org/2ch/-/2ch-0.1.1.tgz","integrity":"sha512-YhvFNFhoSLXIdIlCEgrnSoH8HmabITbYc5AY28PILHOcfep0EcuBPA7xPj9r1/0zdkT9zvftz+2RBCteTo7uAg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGn/b9jacwwOcpskr73LM5YATJYPrm2RcG7vP6Colhy2AiEAxFY8pt7VqLikquChCCaIJbkhzGtCnAOHgeFhvxvjS/Q="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"shiwano","email":"shiwano@gmail.com"},"maintainers":[{"name":"shiwano","email":"shiwano@gmail.com"}]},"0.1.2":{"name":"2ch","description":"A JavaScript library for comfortable 2ch watching.","version":"0.1.2","homepage":"https://github.com/shiwano/2ch","author":{"name":"Shogo Iwano","email":"shiwano@gmail.com"},"repository":{"type":"git","url":"git://github.com/shiwano/2ch.git"},"bugs":{"url":"https://github.com/shiwano/2ch/issues"},"licenses":[{"type":"MIT","url":"https://github.com/shiwano/2ch/blob/master/LICENSE-MIT"}],"main":"lib/2ch","engines":{"node":">= 0.8.0"},"scripts":{"prepublish":"./node_modules/grunt-cli/bin/grunt coffee","test":"./node_modules/grunt-cli/bin/grunt test"},"dependencies":{"lodash":"~1.2.0","iconv":"~2.0.6","superagent":"~0.14.6","encoding":"~0.1.6","moment":"~2.0.0","eventemitter2":"~0.4.11"},"devDependencies":{"grunt":"~0.4.1","grunt-cli":"~0.1.8","grunt-contrib-watch":"~0.5.2","grunt-contrib-coffee":"~0.7.0","grunt-mocha-test":"~0.6.3","mocha":"~1.10.0","sinon":"~1.7.1","chai":"~1.6.0","sinon-chai":"~2.4.0","nock":"~0.18.2"},"peerDependencies":{"grunt":"~0.4.1"},"keywords":[],"readme":"# 2ch [![Build Status](https://secure.travis-ci.org/shiwano/2ch.png?branch=master)](http://travis-ci.org/shiwano/2ch)\nA JavaScript library for comfortable 2ch watching.\n\n## Getting Started\nInstall the module with: `npm install 2ch --save`\n\n```javascript\nvar watcher = new require('2ch').ThreadWatcher('iPhone', /パズル＆ドラゴンズ/);\nwatcher.on('update', function(messages) {\n  // do something.\n});\nwatcher.start();\n```\n\n## Documentation\n### Constructor arguments\n```javascript\nnew ThreadWatcher(bbsName, query, interval [, bbsMenu ])\n```\n\n#### bbsName\nA string which is a valid board name in 2ch.\n\n#### query\nA string or RegExp which is used to find the watched thread.\n\n#### interval (default: 600000)\nA number determining the update interval. It is at least 5000.\n\n#### bbsMenu (default: null)\nA BbsMenu instance object. In most cases, there is no need to specify.\n\n### Methods\nThe ThreadWatcher class inherited from [EventEmitter2](https://github.com/hij1nx/EventEmitter2).\nSo you can use EventEmitter2 methods basically.\n\n#### start\nStart watching 2ch.\n\n#### stop\nStop watching 2ch.\n\n#### isWaching\nReturn `true`, when waching is started. Return `false`, otherwise.\n\n### Events\n#### update\nThe `update` event is emitted, when the watched thread has new messages.\nThe callback take the `messages` argument.\n\n```javascript\nwatcher.on('update', function(messages) {\n  messages.forEach(function(message) {\n    console.log(\n      message.number,\n      message.postedAt.format('YYYY/MM/DD HH:mm:ss'), // moment object.\n      message.name,\n      message.mail,\n      message.tripId,\n      message.body\n    );\n  });\n});\n```\n\n#### error\nThe `error` event is emitted, when a error occured in the library.\nThe callback take the `error` argument.\nIf there is no listener for it, then the default action is to print a stack trace and exit the program.\n\n#### reload\nThe `reload` event is emitted, when the watched thread is reloaded for deleting a message.\nThe callback take the `title` argument.\n\n#### begin\nThe `begin` event is emitted, when the watched thread is found.\nThe callback take the `title` argument.\n\n#### end\nThe `end` event is emitted, when the watched thread is ended.\nThe callback take the `title` argument.\n\n#### notfound\nThe `notfound` event is emitted, when the watched thread is not found by specified query.\n\n## Examples\n```javascript\nvar ThreadWatcher = require('2ch').ThreadWatcher,\n    watcher = new ThreadWatcher('番組ch(NHK)', /NHK総合を常に実況し続けるスレ/, 5000),\n    loaded = false;\n\nwatcher.on('update', function(messages) {\n  if (!loaded) {\n    loaded = true;\n    return;\n  }\n  messages.forEach(function(message) {\n    console.log(\n      message.number,\n      message.name.replace(/<[^<>]+>/g, ''),\n      message.postedAt.format('YYYY/MM/DD HH:mm:ss'), // moment object.\n      message.tripId,\n      message.body.replace(/<[^<>]+>/g, '')\n    );\n  });\n});\n\nwatcher.on('error', function(error) {\n  console.log(error);\n  watcher.stop();\n});\n\nwatcher.on('reload', function(title) {\n  console.log(title, 'のスレッドが再読込されました');\n  loaded = false;\n});\n\nwatcher.on('begin', function(title) {\n  console.log(title, 'のスレッドが開始しました');\n});\n\nwatcher.on('end', function(title) {\n  console.log(title, 'のスレッドが終了しました');\n});\n\nwatcher.start();\n```\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/gruntjs/grunt).\n\n## TODO\n * Browserify\n\n## Release History\n * 2013-09-14   v0.1.2   Remove cheerio.\n * 2013-06-19   v0.1.1   Modified it.\n * 2013-06-17   v0.1.0   First release.\n\n## License\nCopyright (c) 2013 Shogo Iwano\nLicensed under the MIT license.\n","readmeFilename":"README.md","_id":"2ch@0.1.2","dist":{"shasum":"d15b3bb382ab69c0173fea0b4742903ad915074d","tarball":"https://registry.npmjs.org/2ch/-/2ch-0.1.2.tgz","integrity":"sha512-vfufECYat94F9R6yzsTqu65u+adlN5WLP/F3fUACC7unrzXDJWtW14df0JpRgbYt3LnOq8ifo6frA9jAgz6BUw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGD0PuY4qYUKnmibrjtkDiiKmdAwrWrB59YoS08QROAcAiEA5AQrYJWHTqMwT5D53ObAhT0uW2dQjRTZ1gA5GVOYABA="}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"shiwano","email":"shiwano@gmail.com"},"maintainers":[{"name":"shiwano","email":"shiwano@gmail.com"}]},"0.1.3":{"name":"2ch","description":"A JavaScript library for comfortable 2ch watching.","version":"0.1.3","homepage":"https://github.com/shiwano/2ch","author":{"name":"Shogo Iwano","email":"shiwano@gmail.com"},"repository":{"type":"git","url":"git://github.com/shiwano/2ch.git"},"bugs":{"url":"https://github.com/shiwano/2ch/issues"},"licenses":[{"type":"MIT","url":"https://github.com/shiwano/2ch/blob/master/LICENSE-MIT"}],"main":"lib/2ch","engines":{"node":">= 0.8.0"},"scripts":{"prepublish":"./node_modules/grunt-cli/bin/grunt coffee","test":"./node_modules/grunt-cli/bin/grunt test"},"dependencies":{"lodash":"~1.2.0","iconv":"~2.0.6","superagent":"~0.14.6","encoding":"~0.1.6","moment":"~2.0.0","eventemitter2":"~0.4.11"},"devDependencies":{"grunt":"~0.4.1","grunt-cli":"~0.1.8","grunt-contrib-watch":"~0.5.2","grunt-contrib-coffee":"~0.7.0","grunt-mocha-test":"~0.6.3","mocha":"~1.10.0","sinon":"~1.7.1","chai":"~1.6.0","sinon-chai":"~2.4.0","nock":"~0.18.2"},"peerDependencies":{"grunt":"~0.4.1"},"keywords":["2ch"],"readme":"# 2ch [![Build Status](https://secure.travis-ci.org/shiwano/2ch.png?branch=master)](http://travis-ci.org/shiwano/2ch)\nA JavaScript library for comfortable 2ch watching.\n\n## Getting Started\nInstall the module with: `npm install 2ch --save`\n\n```javascript\nvar watcher = new require('2ch').ThreadWatcher('iPhone', /パズル＆ドラゴンズ/);\nwatcher.on('update', function(messages) {\n  // do something.\n});\nwatcher.start();\n```\n\n## Documentation\n### Constructor arguments\n```javascript\nnew ThreadWatcher(bbsName, query, interval [, bbsMenu ])\n```\n\n#### bbsName\nA string which is a valid board name in 2ch.\n\n#### query\nA string or RegExp which is used to find the watched thread.\n\n#### interval (default: 600000)\nA number determining the update interval. It is at least 5000.\n\n#### bbsMenu (default: null)\nA BbsMenu instance object. In most cases, there is no need to specify.\n\n### Methods\nThe ThreadWatcher class inherited from [EventEmitter2](https://github.com/hij1nx/EventEmitter2).\nSo you can use EventEmitter2 methods basically.\n\n#### start\nStart watching 2ch.\n\n#### stop\nStop watching 2ch.\n\n#### isWaching\nReturn `true`, when waching is started. Return `false`, otherwise.\n\n### Events\n#### update\nThe `update` event is emitted, when the watched thread has new messages.\nThe callback take the `messages` argument.\n\n```javascript\nwatcher.on('update', function(messages) {\n  messages.forEach(function(message) {\n    console.log(\n      message.number,\n      message.postedAt.format('YYYY/MM/DD HH:mm:ss'), // moment object.\n      message.name,\n      message.mail,\n      message.tripId,\n      message.body\n    );\n  });\n});\n```\n\n#### error\nThe `error` event is emitted, when a error occured in the library.\nThe callback take the `error` argument.\nIf there is no listener for it, then the default action is to print a stack trace and exit the program.\n\n#### reload\nThe `reload` event is emitted, when the watched thread is reloaded for deleting a message.\nThe callback take the `title` argument.\n\n#### begin\nThe `begin` event is emitted, when the watched thread is found.\nThe callback take the `title` argument.\n\n#### end\nThe `end` event is emitted, when the watched thread is ended.\nThe callback take the `title` argument.\n\n#### notfound\nThe `notfound` event is emitted, when the watched thread is not found by specified query.\n\n## Examples\n```javascript\nvar ThreadWatcher = require('2ch').ThreadWatcher,\n    watcher = new ThreadWatcher('番組ch(NHK)', /NHK総合を常に実況し続けるスレ/, 5000),\n    loaded = false;\n\nwatcher.on('update', function(messages) {\n  if (!loaded) {\n    loaded = true;\n    return;\n  }\n  messages.forEach(function(message) {\n    console.log(\n      message.number,\n      message.name.replace(/<[^<>]+>/g, ''),\n      message.postedAt.format('YYYY/MM/DD HH:mm:ss'), // moment object.\n      message.tripId,\n      message.body.replace(/<[^<>]+>/g, '')\n    );\n  });\n});\n\nwatcher.on('error', function(error) {\n  console.log(error);\n  watcher.stop();\n});\n\nwatcher.on('reload', function(title) {\n  console.log(title, 'のスレッドが再読込されました');\n  loaded = false;\n});\n\nwatcher.on('begin', function(title) {\n  console.log(title, 'のスレッドが開始しました');\n});\n\nwatcher.on('end', function(title) {\n  console.log(title, 'のスレッドが終了しました');\n});\n\nwatcher.start();\n```\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/gruntjs/grunt).\n\n## TODO\n * Browserify\n\n## Release History\n * 2013-11-20   v0.1.3   Fix deleted messages bug.\n * 2013-09-14   v0.1.2   Remove cheerio.\n * 2013-06-19   v0.1.1   Modified it.\n * 2013-06-17   v0.1.0   First release.\n\n## License\nCopyright (c) 2013 Shogo Iwano\nLicensed under the MIT license.\n","readmeFilename":"README.md","_id":"2ch@0.1.3","dist":{"shasum":"05b8ce5588caaf1c91ce025f0512eca2d1e421ec","tarball":"https://registry.npmjs.org/2ch/-/2ch-0.1.3.tgz","integrity":"sha512-iW0Qa8yijVJvcStG5FYsL72ncYv1cuZQd48ySvLxtzDMdaL6hlPqy1R0BB1v451do1QEeSIjM/E8nruS5Fo+EQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEa5MJNOVYf8N/MMmHpntZ1USgSvNk30RDqU7PSHdA3CAiEAxYs2Rf6eU6L4u/AnMCJRMCQ/I6H3JeLf7Myzg3TQO08="}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"shiwano","email":"shiwano@gmail.com"},"maintainers":[{"name":"shiwano","email":"shiwano@gmail.com"}]}},"readme":"# 2ch\nA JavaScript library for comfortable 2ch watching.\n\n## Getting Started\nInstall the module with: `npm install 2ch --save`\n\n```javascript\nvar watcher = new require('2ch').ThreadWatcher({\n  bbsName: 'iPhone',\n  query: /パズル＆ドラゴンズ/,\n});\nwatcher.on('update', function(messages) {\n  // do something.\n});\nwatcher.start();\n```\n\n## Documentation\n### Events\n#### update\nThe `update` event is emitted, when the watched thread has new messages.\nThe callback take the `messages` argument.\n\n```javascript\nwatcher.on('update', function(messages) {\n  messages.forEach(function(message) {\n    console.log(\n      message.number,\n      message.postedAt.format('YYYY/MM/DD HH:mm:ss'), // moment object.\n      message.name,\n      message.mail,\n      message.tripId,\n      message.body\n    );\n  });\n});\n```\n\n#### error\nThe `error` event is emitted, when a error occured in the library.\nThe callback take the `error` argument.\n\nIf there is no listener for it, then the default action is to print a stack trace and exit the program.\n\n#### reload\nThe `reload` event is emitted, when the watched thread is reloaded for deleting a message.\nThe callback take the `title` argument.\n\n#### begin\nThe `begin` event is emitted, when the watched thread is found.\nThe callback take the `title` argument.\n\n#### end\nThe `end` event is emitted, when the watched thread is ended.\nThe callback take the `title` argument.\n\n## Examples\n```javascript\nvar _2ch = require('2ch'),\n    ThreadWatcher = _2ch.ThreadWatcher,\n    BbsMenu = _2ch.BbsMenu;\n\nvar bbsMenu = new BbsMenu(); // common object\n\nvar watcher = new ThreadWatcher({\n  bbsName: '番組ch(NHK)',\n  query: /NHK総合を常に実況し続けるスレ/,\n  interval: 60000, // at least 5000\n  bbsMenu: bbsMenu\n});\n\nwatcher.on('update', function(messages) {\n  messages.forEach(function(message) {\n    console.log(message.number, message.rawString);\n  });\n});\n\nwatcher.on('error', function(error) {\n  console.log(error);\n});\n\nwatcher.on('begin', function(title) {\n  console.log(title, 'のスレッドが立てられました');\n});\n\nwatcher.on('end', function(title) {\n  console.log(title, 'のスレッドが終了しました');\n});\n\nwatcher.start();\n```\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/gruntjs/grunt).\n\n## TODO\n * Browserify\n\n## Release History\n * 2013-06-17   v0.1.0   First release.\n\n## License\nCopyright (c) 2013 Shogo Iwano\nLicensed under the MIT license.\n","maintainers":[{"name":"shiwano","email":"shiwano@gmail.com"}],"time":{"modified":"2022-06-12T14:06:47.140Z","created":"2013-06-16T22:46:42.285Z","0.1.0":"2013-06-16T22:46:49.093Z","0.1.1":"2013-06-18T17:29:06.930Z","0.1.2":"2013-09-14T03:47:36.251Z","0.1.3":"2013-11-20T14:41:56.975Z"},"author":{"name":"Shogo Iwano","email":"shiwano@gmail.com"},"repository":{"type":"git","url":"git://github.com/shiwano/2ch.git"}}