[
  {
    "path": ".babelrc",
    "content": "{\n    \"presets\": [\"env\", \"stage-0\"],\n    \"plugins\": [\n      \"add-module-exports\"\n    ]\n}\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\n/lib/\n/node_modules/"
  },
  {
    "path": ".npmignore",
    "content": "simpleddp.png\n/src/\n/docs/\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\n\nnode_js:\n  - 8\n\nscript:\n  - npm test\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# CHANGELOG\n\n## 2.3.0\n\n* `simpleddp-core` is now a part of `simpleddp`.\n* Fixed bug with setting `sort` in `reactive()` method of `ddpCollection` class (see https://github.com/Gregivy/simpleddp/issues/13).\n* Added new methods `skip()`, `limit()` for `ddpReactiveCollection` class. Both methods are syntactic sugar for `settings()` method.\n* Updated `sub()` method. The returned subscription will be restarted if the same subscription exists and is stopped (see https://github.com/Gregivy/simpleddp/issues/11).\n* Updated `connect()` method. The method now supports `maxTimeout` (see https://github.com/Gregivy/simpleddp/issues/18).\n* New tests added.\n\n## 2.2.4\n\n* Fixed bug with auto re-subscribing when `clearDataOnReconnection=true` (default).\n  Pseudo removing messages arrived later than the first subscription. It was causing\n  possible data loss.\n* Fixex bug with resolving `clearData()`.\n* Updated `simpleddp-core` package.\n* Small changes in plugin system, added event `clientReady`.\n\n## 2.2.3\n\n* Fixed bug with `ddpSubscription.restart` and `ddpSubscription.nosub` when error comes from the server.\n\n## 2.2.2\n\n* Fixed bug with `maxTimeout`.\n\n## 2.2.1\n\n* Fixed bug with `ddpReactiveCollection` sorting. In some cases data array didn't recieve valid updates.\n\n## 2.2.0\n\n* `restartSubsOnConnect` method renamed to `restartSubs`.\n* Added property `clearDataOnReconnection` to `simpleDDP` class constructor.\n* Docs improvments.\n\n## 2.1.1\n\n* Fixed bug with `ddpSubscription` restart (loosing arguments).\n* Fixed rare situation with *ddp* message *removed* arriving before any other.\n* API fix.\n\n## 2.1.0\n\n* Fixed dependencies vulnerabilities.\n* Added documentation for custom EJSON types.\n* Added `maxTimeout` to support the maximum wait for a response from the server to the method call.\n\n## 2.0.2\n\n* Fixed dependencies vulnerabilities.\n\n## 2.0.1\n\n* Fix. If `change` message arrives and no collection is found `simpleddp` acts like it is an `added` message.\n\n## 2.0.0\n\n* Added semantic versioning.\n* `call` renamed to `apply`.\n* New `call` works like `apply` but accepts parameters for server method as a list of function arguments.\n* `subid` property of the subscription object renamed to `subscriptionId`.\n* Added `subscribe` method. Works like `sub` but accepts parameters for server publication as a list of function arguments.\n\n## 1.2.3\n\n* Updated `simpleddp-core` package.\n\n## 1.2.2\n\n* Fixed bug with EJSON types.\n\n## 1.2.1\n\n* Updated `simpleddp-core` package.\n* Added support for putting method call at the beginning of the requests queue.\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2018-2019 Plyushch Gregory (Gregivy)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "[![npm version](https://badge.fury.io/js/simpleddp.svg)](https://badge.fury.io/js/simpleddp)\n[![Build Status](https://travis-ci.org/Gregivy/simpleddp.svg?branch=master)](https://travis-ci.org/Gregivy/simpleddp)\n[![Dependency Status](https://david-dm.org/gregivy/simpleddp.svg)](https://david-dm.org/gregivy/simpleddp)\n[![devDependency Status](https://david-dm.org/gregivy/simpleddp/dev-status.svg)](https://david-dm.org/gregivy/simpleddp#info=devDependencies)\n\n<p align=\"center\">\n  <img width=\"300\" height=\"300\" src=\"https://github.com/Gregivy/simpleddp/raw/master/simpleddp.png\">\n</p>\n\n# SimpleDDP 🥚\n\nThe aim of this library is to simplify the process of working with Meteor.js server over DDP protocol using external JS environments (like Node.js, Cordova, Ionic, ReactNative, etc).\n\nIt is battle tested 🏰 in production and ready to use 🔨.\n\nIf you like this project ⭐ is always welcome.\n\n**Important**\n\nSimpleDDP is written in ES6 and uses modern features like *promises*. Though its precompiled with Babel, your js environment must support ES6 features. So if you are planning to use SimpleDDP be sure that your js environment supports ES6 features or include polyfills yourself (like Babel Polyfill).\n\nProject uses [semantic versioning 2.0.0](https://semver.org/spec/v2.0.0.html).\n\nDDP (protocol) [specification](https://github.com/meteor/meteor/blob/devel/packages/ddp/DDP.md).\n\n## [CHANGE LOG](https://github.com/Gregivy/simpleddp/blob/master/CHANGELOG.md)\n\n## Install\n\n`npm install simpleddp --save`\n\n## [Documentation](https://gregivy.github.io/simpleddp/simpleDDP.html)\n\n## Plugins\n\n* [simpleddp-plugin-login](https://github.com/Gregivy/simpleddp-plugin-login)\n\n## [Adding custom EJSON types](https://github.com/Gregivy/simpleddp/blob/master/custom_ejson.md) ⭐\n\n## Example\n\nFirst of all you need WebSocket implementation for your node app.\nWe will use [isomorphic-ws](https://www.npmjs.com/package/isomorphic-ws) package for this\nsince it works on the client and serverside.\n\n`npm install isomorphic-ws ws --save`\n\nImport/require `simpleDDP`.\n\n```javascript\nconst simpleDDP = require(\"simpleddp\"); // nodejs\nconst ws = require(\"isomorphic-ws\");\n```\n\nor\n\n```javascript\nimport simpleDDP from 'simpleDDP'; // ES6\nimport ws from 'isomorphic-ws';\n```\n\nNow you should make a new simpleDDP instance.\n\n```javascript\nlet opts = {\n    endpoint: \"ws://someserver.com/websocket\",\n    SocketConstructor: ws,\n    reconnectInterval: 5000\n};\nconst server = new simpleDDP(opts);\n```\n\nConnection is not going to be established immediately after you create a simpleDDP instance. If you need to check your connection simply use `server.connected` property which is `true` if you are connected to the server, otherwise it's `false`.\n\nYou can also add some events for connection status.\n\n```javascript\nserver.on('connected', () => {\n    // do something\n});\n\nserver.on('disconnected', () => {\n    // for example show alert to user\n});\n\nserver.on('error', (e) => {\n    // global errors from server\n});\n```\n\nAs an alternative you can use a *async/await* style (or `then(...)`).\n\n```javascript\n(async ()=>{\n  await server.connect();\n  // connection is ready here\n})();\n```\n\nThe next thing we are going to do is subscribing to some publications.\n\n```javascript\nlet userSub = server.subscribe(\"user_pub\");\nlet otherSub = server.subscribe(\"other_pub\",'param1',2); // you can specify arguments for subscription\n\n(async ()=>{\n  await userSub.ready();\n  let nextSub = server.subscribe(\"next_pub\"); // subscribing after userSub is ready\n  await nextSub.ready();\n  //all subs are ready here\n})();\n```\n\nYou can fetch all things you've subscribed for using [server.collection](https://gregivy.github.io/simpleddp/simpleDDP.html#collection) method.\nAlso you can get reactive data sources (plain js objects which will be automatically updated if something changes on the server).\n\n\n```javascript\n(async ()=>{\n\n  // call some method\n  await server.call('somemethod');\n\n  let userSub = server.subscribe(\"user\",userId);\n  await userSub.ready();\n\n  // get non-reactive user object\n  let user = server.collection('users').filter(user=>user.id==userId).fetch()[0];\n\n  // get reactive user object\n  let userReactiveCursor = server.collection('users').filter(user=>user.id==userId).reactive().one();\n  let userReactiveObject = userReactiveCursor.data();\n\n  // observing the changes\n  server.collection('users').filter(user=>user.id==userId).onChange(({prev,next})=>{\n    console.log('previus user data',state.prev);\n    console.log('next user data',state.next);\n  });\n\n  // observing changes in reactive data source\n  userReactiveCursor.onChange((newData)=>{\n    console.log('new user state', newData);\n  });\n\n  let participantsSub = server.subscribe(\"participants\");\n\n  await participantsSub.ready();\n\n  let reactiveCollection = server.collection('participants').reactive();\n\n  // reactive reduce\n  let reducedReactive = reactiveCollection.reduce((acc,val,i,arr)=>{\n    if (i<arr.length-1)  {\n      return acc + val.age;\n    } else {\n      return (acc + val.age)/arr.length;\n    }\n  },0);\n\n  // reactive mean age of all participants\n  let meanAge = reducedReactive.data();\n\n  // observing changes in reactive data source\n  userReactiveCursor.onChange((newData)=>{\n    console.log('new user state', newData);\n  });\n})();\n```\n"
  },
  {
    "path": "core/.babelrc",
    "content": "{\n    \"presets\": [\"es2015\", \"stage-0\"],\n    \"env\": {\n        \"test\": {\n            \"plugins\": [\"istanbul\"]\n        }\n    }\n}\n"
  },
  {
    "path": "core/.eslintrc",
    "content": "{\n    \"extends\": \"eslint:recommended\",\n    \"parser\": \"babel-eslint\",\n    \"env\": {\n        \"browser\": true,\n        \"mocha\": true,\n        \"node\": true,\n        \"meteor\": true\n    },\n    \"rules\": {\n        \"brace-style\": [2, \"1tbs\"],\n        \"comma-spacing\": [2, {\"before\": false, \"after\": true}],\n        \"computed-property-spacing\": [2, \"never\"],\n        \"indent\": [2, 4],\n        \"linebreak-style\": [2, \"unix\"],\n        \"new-cap\": [2, {\"capIsNew\": false}],\n        \"no-console\": [0],\n        \"no-multi-spaces\": [0],\n        \"no-underscore-dangle\": [0],\n        \"object-curly-spacing\": [2, \"never\"],\n        \"one-var\": [2, \"never\"],\n        \"quotes\": [2, \"double\"],\n        \"semi\": [2, \"always\"],\n        \"keyword-spacing\": [2],\n        \"space-before-blocks\": [2, \"always\"],\n        \"space-before-function-paren\": [2, \"always\"],\n        \"space-in-parens\": [2, \"never\"],\n        \"strict\": [2, \"never\"]\n    }\n}\n"
  },
  {
    "path": "core/.gitignore",
    "content": "node_modules/\nnpm-debug.log\ncoverage/\n.nyc_output\nlib/\n.DS_Store\n"
  },
  {
    "path": "core/.npmignore",
    "content": "node_modules/\nnpm-debug.log\ncoverage/\n"
  },
  {
    "path": "core/.npmrc",
    "content": "package-lock=false\n"
  },
  {
    "path": "core/.travis.yml",
    "content": "language: node_js\n\nnode_js:\n  - 8\n\nscript:\n  - npm run lint\n  - npm run coverage\n  - npm run coveralls\n  # - npm run e2e-test\n"
  },
  {
    "path": "core/CHANGELOG.md",
    "content": "# 1.0.6\n\n* Pausing message queue prevents holds every out-coming message.\n\n# 1.0.5\n\n* Now disconnect event won't fire on failed reconnecting events.\n\n# 1.0.4\n\n* Now method calls can be put at the beginning of the call queue.\n* Pause/continue outcoming ddp messages queue.\n* `autoReconnect` value is being saved on disconnect.\n\n# 1.0.3\n\n* Updated `wolfy87-eventemitter` to 5.2.5.\n\n# 1.0.2\n\n* Replaced id checking inside sub method.\n\n# 1.0.1\n\n* Added EJSON support.\n* Added message object to connect emit.\n* Added session id.\n* Added boolean parameter `cleanQueue` to the `DDP` constructor.\n  Determine whether to clean ddp message queue on disconnect or not.\n"
  },
  {
    "path": "core/LICENSE",
    "content": "The MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "core/README.md",
    "content": "[![npm version](https://badge.fury.io/js/simpleddp-core.svg)](https://badge.fury.io/js/simpleddp-core.js)\n[![Build Status](https://travis-ci.org/gregivy/simpleddp-core.svg?branch=master)](https://travis-ci.org/gregivy/simpleddp-core)\n[![Coverage Status](https://img.shields.io/coveralls/gregivy/simpleddp-core.svg)](https://coveralls.io/r/gregivy/simpleddp-core?branch=master)\n[![Dependency Status](https://david-dm.org/gregivy/simpleddp-core.svg)](https://david-dm.org/gregivy/simpleddp-core)\n[![devDependency Status](https://david-dm.org/gregivy/simpleddp-core/dev-status.svg)](https://david-dm.org/gregivy/simpleddp-core#info=devDependencies)\n\n# simpleddp-core\n\nA javascript isomorphic/universal ddp client (successor of [ddp.js](https://github.com/mondora/ddp.js)).\n\n## What is it for?\n\nThe purpose of this library is:\n\n- to set up and maintain a ddp connection with a ddp server, freeing the\n  developer from having to do it on their own\n- to give the developer a clear, consistent API to communicate with the ddp\n  server\n\n## Install\n\nTo install ddp.js using `npm`:\n\n    npm install ddp.js\n\nor using `yarn`:\n\n    yarn add ddp.js\n\n## Example usage\n\n```js\nconst DDP = require(\"ddp.js\");\nconst options = {\n    endpoint: \"ws://localhost:3000/websocket\",\n    SocketConstructor: WebSocket\n};\nconst ddp = new DDP(options);\n\nddp.on(\"connected\", () => {\n    console.log(\"Connected\");\n});\n\nconst subId = ddp.sub(\"mySubscription\");\nddp.on(\"ready\", message => {\n    if (message.subs.includes(subId)) {\n        console.log(\"mySubscription ready\");\n    }\n});\nddp.on(\"added\", message => {\n    console.log(message.collection);\n});\n\nconst myLoginParams = {\n    user: {\n        email: \"user@example.com\"\n    },\n    password: \"hunter2\"\n};\nconst methodId = ddp.method(\"login\", [myLoginParams]);\nddp.on(\"result\", message => {\n    if (message.id === methodId && !message.error) {\n        console.log(\"Logged in!\");\n    }\n});\n```\n\n## Developing\n\nAfter cloning the repository, install `npm` dependencies with `npm install`.\nRun `npm test` to run unit tests, or `npm run dev` to have `mocha` re-run your\ntests when source or test files change.\n\nTo run e2e tests, first [install meteor](https://www.meteor.com/install). Then,\nstart the meteor server with `npm run start-meteor`. Finally, run\n`npm run e2e-test` to run the e2e test suite, or `npm run e2e-dev` to have\n`mocha` re-run the suite when source or test files change.\n\n## Public API\n\n### new DDP(options)\n\nCreates a new DDP instance. After being constructed, the instance will\nestablish a connection with the DDP server and will try to maintain it open.\n\n#### Arguments\n\n- `options` **object** *required*\n\nAvailable options are:\n\n- `cleanQueue` **boolean** *optional* [default: `false`]: whether to clean ddp message\n  queue on disconnect or not.\n\n- `endpoint` **string** *required*: the location of the websocket server. Its\n  format depends on the type of socket you are using.\n\n- `SocketConstructor` **function** *required*: the constructor function that\n  will be used to construct the socket. Meteor (currently the only DDP server\n  available) supports websockets and SockJS sockets.  So, practically speaking,\n  this means that on the browser you can use either the browser's native\n  WebSocket constructor or the SockJS constructor provided by the SockJS\n  library.  On the server you can use whichever library implements the\n  websocket protocol (e.g.  faye-websocket).\n\n- `autoConnect` **boolean** *optional* [default: `true`]: whether to establish\n  the connection to the server upon instantiation. When `false`, one can\n  manually establish the connection with the `connect` method.\n\n- `autoReconnect` **boolean** *optional* [default: `true`]: whether to try to\n  reconnect to the server when the socket connection closes, unless the closing\n  was initiated by a call to the `disconnect` method.\n\n- `reconnectInterval` **number** *optional* [default: 10000]: the interval in ms\n  between reconnection attempts.\n\n#### Returns\n\nA new DDP instance, which is also an `EventEmitter` instance.\n\n---\n\n### DDP.method(name, params)\n\nCalls a remote method.\n\n#### Arguments\n\n- `name` **string** *required*: name of the method to call.\n\n- `params` **array** *required*: array of parameters to pass to the remote\n  method. Pass an empty array if you do not wish to pass any parameters.\n\n#### Returns\n\nThe unique `id` (string) corresponding to the method call.\n\n#### Example usage\n\nServer code:\n```js\nMeteor.methods({\n    myMethod (param_0, param_1, param_2) {\n        /* ... */\n    }\n});\n```\nClient code:\n```js\nconst methodCallId = ddp.method(\"myMethod\", [param_0, param_1, param_2]);\n```\n\n---\n\n### DDP.sub(name, params)\n\nSubscribes to a server publication.\n\n#### Arguments\n\n- `name` **string** *required*: name of the server publication.\n\n- `params` **array** *required*: array of parameters to pass to the server\n  publish function. Pass an empty array if you do not wish to pass any\n  parameters.\n\n#### Returns\n\nThe unique `id` (string) corresponding to the subscription call.\n\n#### Example usage\n\nServer code:\n```js\nMeteor.publish(\"myPublication\", (param_0, param_1, param_2) {\n    /* ... */\n});\n```\nClient code:\n```js\nconst subscriptionId = ddp.sub(\"myPublication\", [param_0, param_1, param_2]);\n```\n\n---\n\n### DDP.unsub(id)\n\nUnsubscribes to a previously-subscribed server publication.\n\n#### Arguments\n\n- `id` **string** *required*: id of the subscription.\n\n#### Returns\n\nThe `id` corresponding to the subscription call (not of much use, but I return\nit for consistency).\n\n---\n\n### DDP.connect()\n\nConnects to the ddp server. The method is called automatically by the class\nconstructor if the `autoConnect` option is set to `true` (default behaviour).\nSo there generally should be no need for the developer to call the method\nthemselves.\n\n#### Arguments\n\nNone\n\n#### Returns\n\nNone\n\n---\n\n### DDP.disconnect()\n\nDisconnects from the ddp server by closing the `WebSocket` connection. You can\nlisten on the `disconnected` event to be notified of the disconnection.\n\n#### Arguments\n\nNone\n\n#### Returns\n\nNone\n\n## Public events\n\n### Connection events\n\n- `connected`: emitted with no arguments when the DDP connection is\n  established.\n\n- `disconnected`: emitted with no arguments when the DDP connection drops.\n\n### Subscription events\n\nAll the following events are emitted with one argument, the parsed DDP message.\nFurther details can be found [on the DDP spec\npage](https://github.com/meteor/meteor/blob/devel/packages/ddp/DDP.md).\n\n- `ready`\n- `nosub`\n- `added`\n- `changed`\n- `removed`\n\n### Method events\n\nAll the following events are emitted with one argument, the parsed DDP message.\nFurther details can be found [on the DDP spec\npage](https://github.com/meteor/meteor/blob/devel/packages/ddp/DDP.md).\n\n- `result`\n- `updated`\n"
  },
  {
    "path": "core/package.json",
    "content": "{\n  \"name\": \"simpleddp-core\",\n  \"version\": \"1.0.6\",\n  \"description\": \"ddp javascript client\",\n  \"main\": \"lib/ddp.js\",\n  \"scripts\": {\n    \"build\": \"babel src --out-dir lib\",\n    \"clean\": \"rimraf lib coverage\",\n    \"coverage\": \"nyc --require babel-register --reporter=lcov --include src --all npm test\",\n    \"coveralls\": \"cat ./coverage/lcov.info | coveralls\",\n    \"dev\": \"npm test -- --watch\",\n    \"lint\": \"eslint src test\",\n    \"prepare\": \"npm run clean && npm run build\",\n    \"test\": \"mocha --require babel-register --recursive test/unit\",\n    \"start-meteor\": \"cd test/server/ && meteor\",\n    \"e2e-test\": \"mocha --require babel-register --recursive test/e2e\",\n    \"e2e-dev\": \"npm run e2e-test -- --watch\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/gregivy/simpleddp-core\"\n  },\n  \"keywords\": [\n    \"ddp\",\n    \"meteor\",\n    \"simpleddp\",\n    \"core\"\n  ],\n  \"author\": \"Plyushch Gregory <gpoi.mail@gmail.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/gregivy/simpleddp-core/issues\"\n  },\n  \"homepage\": \"https://github.com/gregivy/simpleddp-core\",\n  \"devDependencies\": {\n    \"ajv\": \"^5.5.2\",\n    \"babel-cli\": \"^6.26.0\",\n    \"babel-eslint\": \"^8.0.1\",\n    \"babel-plugin-istanbul\": \"^4.1.5\",\n    \"babel-preset-es2015\": \"^6.24.1\",\n    \"babel-preset-stage-0\": \"^6.24.1\",\n    \"babel-register\": \"^6.26.0\",\n    \"chai\": \"^4.1.2\",\n    \"coveralls\": \"^3.0.0\",\n    \"eslint\": \"^4.9.0\",\n    \"faye-websocket\": \"^0.11.1\",\n    \"mocha\": \"^4.0.1\",\n    \"nyc\": \"^11.2.1\",\n    \"sinon\": \"^4.0.2\",\n    \"sinon-chai\": \"^2.14.0\"\n  },\n  \"dependencies\": {\n    \"ejson\": \"^2.1.2\",\n    \"wolfy87-eventemitter\": \"^5.2.5\"\n  }\n}\n"
  },
  {
    "path": "core/src/ddp.js",
    "content": "import EventEmitter from \"wolfy87-eventemitter\";\nimport Queue from \"./queue\";\nimport Socket from \"./socket\";\nimport {contains, uniqueId} from \"./utils\";\n\nconst DDP_VERSION = \"1\";\nconst PUBLIC_EVENTS = [\n    // Subscription messages\n    \"ready\", \"nosub\", \"added\", \"changed\", \"removed\",\n    // Method messages\n    \"result\", \"updated\",\n    // Error messages\n    \"error\"\n];\nconst DEFAULT_RECONNECT_INTERVAL = 10000;\n\nexport default class DDP extends EventEmitter {\n\n    emit () {\n        setTimeout(super.emit.bind(this, ...arguments), 0);\n    }\n\n    constructor (options) {\n\n        super();\n\n        this.status = \"disconnected\";\n\n        //DDP session id\n        this.sessionId = null;\n\n        //clean queue on disconnect or not, default to false\n        this.cleanQueue = (options.cleanQueue === true);\n\n        // Default `autoConnect` and `autoReconnect` to true\n        this.autoConnect = (options.autoConnect !== false);\n        this.autoReconnect = (options.autoReconnect !== false);\n        this.autoReconnectUserValue = this.autoReconnect;\n        this.reconnectInterval = options.reconnectInterval || DEFAULT_RECONNECT_INTERVAL;\n\n        this.messageQueue = new Queue(message => {\n            if (this.status === \"connected\") {\n                this.socket.send(message);\n                return true;\n            } else {\n                return false;\n            }\n        });\n\n        this.socket = new Socket(options.SocketConstructor, options.endpoint);\n\n        this.socket.on(\"open\", () => {\n            // When the socket opens, send the `connect` message\n            // to establish the DDP connection\n            let params = {\n                msg: \"connect\",\n                version: DDP_VERSION,\n                support: [DDP_VERSION]\n            };\n            if (this.sessionId) params.session = this.sessionId;\n            this.socket.send(params);\n        });\n\n        this.socket.on(\"close\", () => {\n            let oldStatus = this.status;\n            this.status = \"disconnected\";\n            if (this.cleanQueue) this.messageQueue.empty();\n            if (oldStatus != \"disconnected\") this.emit(\"disconnected\");\n            if (this.autoReconnect) {\n                // Schedule a reconnection\n                setTimeout(\n                    this.socket.open.bind(this.socket),\n                    this.reconnectInterval\n                );\n            }\n        });\n\n        this.socket.on(\"message:in\", message => {\n            if (message.msg === \"connected\") {\n                this.status = \"connected\";\n                this.sessionId = message.session ? message.session : null;\n                this.messageQueue.process();\n                this.emit(\"connected\", message);\n            } else if (message.msg === \"ping\") {\n                // Reply with a `pong` message to prevent the server from\n                // closing the connection\n                this.socket.send({msg: \"pong\", id: message.id});\n            } else if (contains(PUBLIC_EVENTS, message.msg)) {\n                this.emit(message.msg, message);\n            }\n        });\n\n        if (this.autoConnect) {\n            this.connect();\n        }\n\n    }\n\n    connect () {\n        this.autoReconnect = this.autoReconnectUserValue;\n        this.socket.open();\n    }\n\n    disconnect () {\n        /*\n        *   If `disconnect` is called, the caller likely doesn't want the\n        *   the instance to try to auto-reconnect. Therefore we set the\n        *   `autoReconnect` flag to false.\n        *   Also we should remember autoReconnect value to restore it on connect.\n        */\n        this.autoReconnectUserValue = this.autoReconnect;\n        this.autoReconnect = false;\n        this.sessionId = null;\n        this.socket.close();\n    }\n\n    pauseQueue() {\n      this.messageQueue.pause();\n    }\n\n    continueQueue() {\n      this.messageQueue.continue();\n    }\n\n    method (name, params, atBeginning = false) {\n        const id = uniqueId();\n        this.messageQueue[atBeginning?'unshift':'push']({\n            msg: \"method\",\n            id: id,\n            method: name,\n            params: params\n        });\n        return id;\n    }\n\n    sub (name, params, id = uniqueId()) {\n        this.messageQueue.push({\n            msg: \"sub\",\n            id: id,\n            name: name,\n            params: params\n        });\n        return id;\n    }\n\n    unsub (id) {\n        this.messageQueue.push({\n            msg: \"unsub\",\n            id: id\n        });\n        return id;\n    }\n\n}\n"
  },
  {
    "path": "core/src/queue.js",
    "content": "export default class Queue {\n\n    /*\n    *   As the name implies, `\u001bconsumer` is the (sole) consumer of the queue.\n    *   It gets called with each element of the queue and its return value\n    *   serves as a ack, determining whether the element is removed or not from\n    *   the queue, allowing then subsequent elements to be processed.\n    */\n\n    constructor (consumer) {\n        this.consumer = consumer;\n        this.paused = false;\n        this.queue = [];\n    }\n\n    pause () {\n      this.paused = true;\n    }\n\n    continue () {\n      this.paused = false;\n      this.process();\n    }\n\n    push (element) {\n        this.queue.push(element);\n        this.process();\n    }\n\n    unshift (element) {\n        this.queue.unshift(element);\n        this.process();\n    }\n\n    process (opts) {\n        if (!this.paused && this.queue.length !== 0) {\n            const ack = this.consumer(this.queue[0]);\n            if (ack) {\n                this.queue.shift();\n                if (!this.paused) this.process();\n            }\n        }\n    }\n\n    empty () {\n        this.queue = [];\n    }\n\n}\n"
  },
  {
    "path": "core/src/socket.js",
    "content": "import EventEmitter from \"wolfy87-eventemitter\";\nimport EJSON from \"ejson\";\n\nexport default class Socket extends EventEmitter {\n\n    constructor (SocketConstructor, endpoint) {\n        super();\n        this.SocketConstructor = SocketConstructor;\n        this.endpoint = endpoint;\n        this.rawSocket = null;\n    }\n\n    send (object) {\n        const message = EJSON.stringify(object);\n        this.rawSocket.send(message);\n        // Emit a copy of the object, as the listener might mutate it.\n        this.emit(\"message:out\", EJSON.parse(message));\n    }\n\n    open () {\n\n        /*\n        *   Makes `open` a no-op if there's already a `rawSocket`. This avoids\n        *   memory / socket leaks if `open` is called twice (e.g. by a user\n        *   calling `ddp.connect` twice) without properly disposing of the\n        *   socket connection. `rawSocket` gets automatically set to `null` only\n        *   when it goes into a closed or error state. This way `rawSocket` is\n        *   disposed of correctly: the socket connection is closed, and the\n        *   object can be garbage collected.\n        */\n        if (this.rawSocket) {\n            return;\n        }\n        this.rawSocket = new this.SocketConstructor(this.endpoint);\n\n        /*\n        *   Calls to `onopen` and `onclose` directly trigger the `open` and\n        *   `close` events on the `Socket` instance.\n        */\n        this.rawSocket.onopen = () => this.emit(\"open\");\n        this.rawSocket.onclose = () => {\n            this.rawSocket = null;\n            this.emit(\"close\");\n        };\n        /*\n        *   Calls to `onerror` trigger the `close` event on the `Socket`\n        *   instance, and cause the `rawSocket` object to be disposed of.\n        *   Since it's not clear what conditions could cause the error and if\n        *   it's possible to recover from it, we prefer to always close the\n        *   connection (if it isn't already) and dispose of the socket object.\n        */\n        this.rawSocket.onerror = () => {\n            // It's not clear what the socket lifecycle is when errors occurr.\n            // Hence, to avoid the `close` event to be emitted twice, before\n            // manually closing the socket we de-register the `onclose`\n            // callback.\n            if (this.rawSocket && this.rawSocket.onclose)\n              delete this.rawSocket.onclose;\n            // Safe to perform even if the socket is already closed\n            this.rawSocket.close();\n            this.rawSocket = null;\n            this.emit(\"close\");\n        };\n        /*\n        *   Calls to `onmessage` trigger a `message:in` event on the `Socket`\n        *   instance only once the message (first parameter to `onmessage`) has\n        *   been successfully parsed into a javascript object.\n        */\n        this.rawSocket.onmessage = message => {\n            var object;\n            try {\n                object = EJSON.parse(message.data);\n            } catch (ignore) {\n                // Simply ignore the malformed message and return\n                return;\n            }\n            // Outside the try-catch block as it must only catch EJSON parsing\n            // errors, not errors that may occur inside a \"message:in\" event\n            // handler\n            this.emit(\"message:in\", object);\n        };\n\n    }\n\n    close () {\n        /*\n        *   Avoid throwing an error if `rawSocket === null`\n        */\n        if (this.rawSocket) {\n            this.rawSocket.close();\n        }\n    }\n\n}\n"
  },
  {
    "path": "core/src/utils.js",
    "content": "var i = 0;\nexport function uniqueId () {\n    return (i++).toString();\n}\n\nexport function contains (array, element) {\n    return array.indexOf(element) !== -1;\n}\n"
  },
  {
    "path": "core/test/e2e/connection.js",
    "content": "import chai, {expect} from \"chai\";\nimport {Client} from \"faye-websocket\";\nimport sinon from \"sinon\";\nimport sinonChai from \"sinon-chai\";\n\nimport DDP from \"../../src/ddp\";\n\nchai.use(sinonChai);\n\nconst options = {\n    endpoint: \"ws://localhost:3000/websocket\",\n    SocketConstructor: Client\n};\n\ndescribe(\"connection\", () => {\n\n    var ddp = null;\n    afterEach(done => {\n        if (ddp) {\n            ddp.on(\"disconnected\", () => done());\n            ddp.disconnect();\n            ddp = null;\n        } else {\n            done();\n        }\n    });\n\n    describe(\"connecting\", () => {\n\n        it(\"a connection is established on instantiation unless `autoConnect === false`\", done => {\n            /*\n            *   The test suceeds when the `connected` event is fired, signaling\n            *   the establishment of the connection.\n            *   If the event is never fired, the test times out and fails.\n            */\n            ddp = new DDP(options);\n            ddp.on(\"connected\", () => {\n                done();\n            });\n        });\n\n        it(\"a connection is not established on instantiation when `autoConnect === false`\", done => {\n            /*\n            *   The test succeeds if, 1s after the creation of the DDP instance,\n            *   a `connected` event has not been fired.\n            */\n            const ddp = new DDP({\n                ...options,\n                autoConnect: false\n            });\n            const connectedHandler = sinon.spy();\n            ddp.on(\"connected\", connectedHandler);\n            setTimeout(() => {\n                try {\n                    expect(connectedHandler).to.have.callCount(0);\n                    done();\n                } catch (e) {\n                    done(e);\n                }\n            }, 1000);\n        });\n\n        it(\"a connection can be established manually when `autoConnect === false`\", done => {\n            /*\n            *   The test suceeds when the `connected` event is fired, signaling\n            *   the establishment of the connection.\n            *   If the event is never fired, the test times out and fails.\n            */\n            ddp = new DDP({\n                ...options,\n                autoConnect: false\n            });\n            ddp.connect();\n            ddp.on(\"connected\", () => {\n                done();\n            });\n        });\n\n        it(\"manually connecting several times doesn't causes multiple simultaneous connections [CASE: `autoConnect === true`]\", done => {\n            /*\n            *   The test suceeds if 1s after having called `connect` several\n            *   times only one connection has been established.\n            */\n            ddp = new DDP(options);\n            const connectedSpy = sinon.spy();\n            ddp.connect();\n            ddp.connect();\n            ddp.connect();\n            ddp.connect();\n            ddp.on(\"connected\", connectedSpy);\n            setTimeout(() => {\n                try {\n                    expect(connectedSpy).to.have.callCount(1);\n                    done();\n                } catch (e) {\n                    done(e);\n                }\n            }, 1000);\n        });\n\n        it(\"manually connecting several times doesn't causes multiple simultaneous connections [CASE: `autoConnect === false`]\", done => {\n            /*\n            *   The test suceeds if 1s after having called `connect` several\n            *   times only one connection has been established.\n            */\n            ddp = new DDP({\n                ...options,\n                autoConnect: false\n            });\n            const connectedSpy = sinon.spy();\n            ddp.connect();\n            ddp.connect();\n            ddp.connect();\n            ddp.connect();\n            ddp.on(\"connected\", connectedSpy);\n            setTimeout(() => {\n                try {\n                    expect(connectedSpy).to.have.callCount(1);\n                    done();\n                } catch (e) {\n                    done(e);\n                }\n            }, 1000);\n        });\n\n    });\n\n    describe(\"disconnecting\", () => {\n\n        it(\"the connection is closed when calling `disconnect`\", done => {\n            /*\n            *   The test suceeds when the `disconnected` event is fired,\n            *   signaling the termination of the connection.\n            *   If the event is never fired, the test times out and fails.\n            */\n            const ddp = new DDP(options);\n            ddp.on(\"connected\", () => {\n                ddp.disconnect();\n            });\n            ddp.on(\"disconnected\", () => {\n                done();\n            });\n        });\n\n        it(\"calling `disconnect` several times causes no issues\", done => {\n            /*\n            *   The test suceeds if:\n            *   - calling `disconnect` several times doesn't throw, both before\n            *     and after the `disconnected` event has been received\n            *   - one and only one `disconnected` event is fired (check after\n            *     1s)\n            */\n            const ddp = new DDP(options);\n            const disconnectSpy = sinon.spy(() => {\n                try {\n                    ddp.disconnect();\n                    ddp.disconnect();\n                    ddp.disconnect();\n                    ddp.disconnect();\n                } catch (e) {\n                    done(e);\n                }\n            });\n            ddp.on(\"connected\", () => {\n                try {\n                    ddp.disconnect();\n                    ddp.disconnect();\n                    ddp.disconnect();\n                    ddp.disconnect();\n                } catch (e) {\n                    done(e);\n                }\n            });\n            ddp.on(\"disconnected\", disconnectSpy);\n            setTimeout(() => {\n                try {\n                    expect(disconnectSpy).to.have.callCount(1);\n                    done();\n                } catch (e) {\n                    done(e);\n                }\n            }, 1000);\n        });\n\n        it(\"the connection is closed when calling `disconnect` and it's not re-established\", done => {\n            /*\n            *   The test suceeds if, 1s after the `disconnected` event has been\n            *   fired, there hasn't been any reconnection.\n            */\n            const ddp = new DDP({\n                ...options,\n                reconnectInterval: 10\n            });\n            const disconnectOnConnection = sinon.spy(() => {\n                ddp.disconnect();\n            });\n            ddp.on(\"connected\", disconnectOnConnection);\n            ddp.on(\"disconnected\", () => {\n                setTimeout(() => {\n                    try {\n                        expect(disconnectOnConnection).to.have.callCount(1);\n                        done();\n                    } catch (e) {\n                        done(e);\n                    }\n                }, 1000);\n            });\n        });\n\n        it(\"the connection is closed and re-established when the server closes the connection, unless `autoReconnect === true`\", done => {\n            /*\n            *   The test suceeds when the `connect` event is fired a second time\n            *   after the client gets disconnected from the server (occurrence\n            *   marked by the `disconnected` event).\n            *   If the event is never fired a second time, the test times out\n            *   and fails.\n            */\n            ddp = new DDP({\n                ...options,\n                reconnectInterval: 10\n            });\n            var callCount = 0;\n            ddp.on(\"connected\", () => {\n                callCount += 1;\n                if (callCount === 1) {\n                    ddp.method(\"disconnectMe\", []);\n                }\n                if (callCount === 2) {\n                    done();\n                }\n            });\n        });\n\n        it(\"the connection is closed and _not_ re-established when the server closes the connection and `autoReconnect === false`\", done => {\n            /*\n            *   The test suceeds if, 1s after the `disconnected` event has been\n            *   fired, there hasn't been any reconnection.\n            */\n            const ddp = new DDP({\n                ...options,\n                reconnectInterval: 10,\n                autoReconnect: false\n            });\n            const disconnectMe = sinon.spy(() => {\n                ddp.method(\"disconnectMe\", []);\n            });\n            ddp.on(\"connected\", disconnectMe);\n            ddp.on(\"disconnected\", () => {\n                setTimeout(() => {\n                    try {\n                        expect(disconnectMe).to.have.callCount(1);\n                        done();\n                    } catch (e) {\n                        done(e);\n                    }\n                }, 1000);\n            });\n        });\n\n        describe(\"ddp.js issue #22\", () => {\n\n            /*\n            *   We need to test that no `uncaughtException`-s are raised. Since\n            *   mocha adds a listener to the `uncaughtException` event which\n            *   causes tests to fail in an unexpected manner, we first remove\n            *   that listener, and then we restore it. Since it's not clear\n            *   _what_ mocha does with that listener, we try to lower the\n            *   meddling impact by doing all of our work inside the `it` block.\n            */\n\n            it(\"no issues when sending messages while disconnected / while disconnecting\", done => {\n                /*\n                *   The test suceeds if, 100ms after the `disconnected` event\n                *   has been fired, there haven't been any uncaught exceptions.\n                */\n                const catcher = sinon.spy();\n                const listeners = process.listeners(\"uncaughtException\");\n                process.removeAllListeners(\"uncaughtException\");\n                process.on(\"uncaughtException\", catcher);\n                const ddp = new DDP({\n                    ...options,\n                    autoReconnect: false\n                });\n                ddp.on(\"connected\", () => {\n                    ddp.disconnect();\n                });\n                const interval = setInterval(() => {\n                    ddp.method(\"echo\", []);\n                }, 1);\n                ddp.on(\"disconnected\", () => {\n                    setTimeout(runAssertions, 100);\n                });\n                const runAssertions = () => {\n                    clearInterval(interval);\n                    process.removeAllListeners(\"uncaughtException\");\n                    listeners.forEach(listener => {\n                        process.on(\"uncaughtException\", listener);\n                    });\n                    try {\n                        expect(catcher).to.have.callCount(0);\n                        done();\n                    } catch (e) {\n                        done(e);\n                    }\n                };\n            });\n\n        });\n\n    });\n\n});\n"
  },
  {
    "path": "core/test/e2e/methods.js",
    "content": "import {expect} from \"chai\";\nimport {Client} from \"faye-websocket\";\n\nimport DDP from \"../../src/ddp\";\n\ndescribe(\"methods\", () => {\n\n    describe(\"calling a method\", () => {\n\n        const ddp = new DDP({\n            endpoint: \"ws://localhost:3000/websocket\",\n            SocketConstructor: Client\n        });\n\n        after(done => {\n            ddp.on(\"disconnected\", () => done());\n            ddp.disconnect();\n        });\n\n        it(\"invokes the method on the server and gets a `result` message with the response\", done => {\n            /*\n            *   The test suceeds when the `result` message for the echo method\n            *   call is received, and assertions all succeed.\n            *   If the `result` message is never received, the test times out\n            *   and fails. Naturally, the test also fails if assertions fail.\n            */\n            const methodId = ddp.method(\"echo\", [0, 1, 2, 3, 4]);\n            ddp.on(\"result\", message => {\n                if (message.id !== methodId || message.error) {\n                    return;\n                }\n                try {\n                    expect(message.result).to.deep.equal([0, 1, 2, 3, 4]);\n                    done();\n                } catch (e) {\n                    done(e);\n                }\n            });\n        });\n\n        it(\"gets an `updated` message\", done => {\n            /*\n            *   The test suceeds when the `updated` message for the echo method\n            *   call is received.\n            *   If the `updated` message is never received, the test times out\n            *   and fails.\n            */\n            const methodId = ddp.method(\"echo\", [0, 1, 2, 3, 4]);\n            ddp.on(\"updated\", message => {\n                if (message.methods.indexOf(methodId) !== -1) {\n                    done();\n                }\n            });\n        });\n\n    });\n\n});\n"
  },
  {
    "path": "core/test/e2e/subscriptions.js",
    "content": "import {expect} from \"chai\";\nimport {Client} from \"faye-websocket\";\n\nimport DDP from \"../../src/ddp\";\n\ndescribe(\"subscriptions\", () => {\n\n    describe(\"subscribing to a publication\", () => {\n\n        const ddp = new DDP({\n            endpoint: \"ws://localhost:3000/websocket\",\n            SocketConstructor: Client\n        });\n\n        after(done => {\n            ddp.on(\"disconnected\", () => done());\n            ddp.disconnect();\n        });\n\n        it(\"sends a sub call to the server and receives server-sent scubscription events\", done => {\n            /*\n            *   The test suceeds when the `ready` message for the echo\n            *   subscription is received, and assertions all succeed.\n            *   If the `ready` message is never received, the test times out\n            *   and fails. Naturally, the test also fails if assertions fail.\n            */\n            const subId = ddp.sub(\"echo\", [0, 1, 2, 3, 4]);\n            const collections = {};\n            ddp.on(\"added\", message => {\n                collections[message.collection] = {\n                    ...collections[message.collection],\n                    [message.id]: {\n                        _id: message.id,\n                        ...message.fields\n                    }\n                };\n            });\n            ddp.on(\"ready\", message => {\n                if (message.subs.indexOf(subId) === -1) {\n                    return;\n                }\n                try {\n                    expect(collections).to.deep.equal({\n                        echoParameters: {\n                            \"id_0\": {_id: \"id_0\", param: 0},\n                            \"id_1\": {_id: \"id_1\", param: 1},\n                            \"id_2\": {_id: \"id_2\", param: 2},\n                            \"id_3\": {_id: \"id_3\", param: 3},\n                            \"id_4\": {_id: \"id_4\", param: 4}\n                        }\n                    });\n                    done();\n                } catch (e) {\n                    done(e);\n                }\n            });\n        });\n\n    });\n\n    describe(\"unsubscribing from a publication\", () => {\n\n        const ddp = new DDP({\n            endpoint: \"ws://localhost:3000/websocket\",\n            SocketConstructor: Client\n        });\n\n        after(done => {\n            ddp.on(\"disconnected\", () => done());\n            ddp.disconnect();\n        });\n\n        it(\"sends an unsub call to the server and receives a nosub unsubscriptions confirmation event\", done => {\n            /*\n            *   The test suceeds when the `nosub` message for the echo\n            *   subscription is received. If the `nosub` message is never\n            *   received, the test times out and fails.\n            */\n            const subId = ddp.sub(\"echo\", [0, 1, 2, 3, 4]);\n            ddp.on(\"ready\", message => {\n                if (message.subs.indexOf(subId) === -1) {\n                    return;\n                }\n                ddp.unsub(subId);\n            });\n            ddp.on(\"nosub\", message => {\n                if (message.id !== subId) {\n                    return;\n                }\n                done();\n            });\n        });\n\n    });\n\n    describe(\"getting unsubscribed from a publication\", () => {\n\n        const ddp = new DDP({\n            endpoint: \"ws://localhost:3000/websocket\",\n            SocketConstructor: Client\n        });\n\n        after(done => {\n            ddp.on(\"disconnected\", () => done());\n            ddp.disconnect();\n        });\n\n        it(\"receives a nosub unsubscriptions event\", function (done) {\n            /*\n            *   The test suceeds when the `nosub` message for the echo\n            *   subscription is received. If the `nosub` message is never\n            *   received, the test times out and fails.\n            *   The server will stop the subscription after about 1s, so there\n            *   is no need to terminate it with an `unsub`. We will however\n            *   increase the test timeout to 3s to account for the delay.\n            */\n            this.timeout(3000);\n            const subId = ddp.sub(\"autoTerminating\");\n            var subReady = false;\n            ddp.on(\"ready\", message => {\n                if (message.subs.indexOf(subId) !== -1) {\n                    subReady = true;\n                }\n            });\n            ddp.on(\"nosub\", message => {\n                if (message.id !== subId) {\n                    return;\n                }\n                try {\n                    // Ensure the subscription got marked as ready.\n                    expect(subReady).to.equal(true);\n                    done();\n                } catch (e) {\n                    done(e);\n                }\n            });\n        });\n\n    });\n\n});\n"
  },
  {
    "path": "core/test/server/.meteor/.finished-upgraders",
    "content": "# This file contains information which helps Meteor properly upgrade your\n# app when you run 'meteor update'. You should check it into version control\n# with your project.\n\nnotices-for-0.9.0\nnotices-for-0.9.1\n0.9.4-platform-file\nnotices-for-facebook-graph-api-2\n1.2.0-standard-minifiers-package\n1.2.0-meteor-platform-split\n1.2.0-cordova-changes\n1.2.0-breaking-changes\n1.3.0-split-minifiers-package\n1.4.0-remove-old-dev-bundle-link\n1.4.1-add-shell-server-package\n1.4.3-split-account-service-packages\n1.5-add-dynamic-import-package\n"
  },
  {
    "path": "core/test/server/.meteor/.gitignore",
    "content": "local\n"
  },
  {
    "path": "core/test/server/.meteor/.id",
    "content": "# This file contains a token that is unique to your project.\n# Check it into your repository along with the rest of this directory.\n# It can be used for purposes such as:\n#   - ensuring you don't accidentally deploy one app on top of another\n#   - providing package authors with aggregated statistics\n\nydh6g2121jjwyqq7agh\n"
  },
  {
    "path": "core/test/server/.meteor/packages",
    "content": "# Meteor packages used by this project, one per line.\n# Check this file (and the other files in this directory) into your repository.\n#\n# 'meteor add' and 'meteor remove' will edit this file for you,\n# but you can also edit it by hand.\n\nmeteor-base@1.1.0             # Packages every Meteor app needs to have\nmobile-experience@1.0.5       # Packages for a great mobile UX\nmongo@1.2.2                   # The database Meteor supports right now\nblaze-html-templates    # Compile .html files into Meteor Blaze views\nsession@1.1.7                 # Client-side reactive dictionary for your app\njquery@1.11.10                  # Helpful client-side library\ntracker@1.1.3                 # Meteor's client-side reactive programming library\n\nes5-shim@4.6.15                # ECMAScript 5 compatibility for older browsers.\n\nstandard-minifier-css\nstandard-minifier-js\nshell-server\ndynamic-import\n"
  },
  {
    "path": "core/test/server/.meteor/platforms",
    "content": "server\nbrowser\n"
  },
  {
    "path": "core/test/server/.meteor/release",
    "content": "METEOR@1.5.2.2\n"
  },
  {
    "path": "core/test/server/.meteor/versions",
    "content": "allow-deny@1.0.9\nautoupdate@1.3.12\nbabel-compiler@6.20.0\nbabel-runtime@1.0.1\nbase64@1.0.10\nbinary-heap@1.0.10\nblaze@2.3.2\nblaze-html-templates@1.1.2\nblaze-tools@1.0.10\nboilerplate-generator@1.2.0\ncaching-compiler@1.1.9\ncaching-html-compiler@1.1.2\ncallback-hook@1.0.10\ncheck@1.2.5\nddp@1.3.1\nddp-client@2.1.3\nddp-common@1.2.9\nddp-server@2.0.2\ndeps@1.0.12\ndiff-sequence@1.0.7\ndynamic-import@0.1.3\necmascript@0.8.3\necmascript-runtime@0.4.1\necmascript-runtime-client@0.4.3\necmascript-runtime-server@0.4.1\nejson@1.0.14\nes5-shim@4.6.15\ngeojson-utils@1.0.10\nhot-code-push@1.0.4\nhtml-tools@1.0.11\nhtmljs@1.0.11\nhttp@1.2.12\nid-map@1.0.9\njquery@1.11.10\nlaunch-screen@1.1.1\nlivedata@1.0.18\nlogging@1.1.19\nmeteor@1.7.2\nmeteor-base@1.1.0\nminifier-css@1.2.16\nminifier-js@2.1.4\nminimongo@1.3.3\nmobile-experience@1.0.5\nmobile-status-bar@1.0.14\nmodules@0.10.0\nmodules-runtime@0.8.0\nmongo@1.2.2\nmongo-dev-server@1.0.1\nmongo-id@1.0.6\nnpm-mongo@2.2.33\nobserve-sequence@1.0.16\nordered-dict@1.0.9\npromise@0.9.0\nrandom@1.0.10\nreactive-dict@1.1.9\nreactive-var@1.0.11\nreload@1.1.11\nretry@1.0.9\nroutepolicy@1.0.12\nsession@1.1.7\nshell-server@0.2.4\nspacebars@1.0.15\nspacebars-compiler@1.1.3\nstandard-minifier-css@1.3.5\nstandard-minifier-js@2.1.2\ntemplating@1.3.2\ntemplating-compiler@1.3.3\ntemplating-runtime@1.3.2\ntemplating-tools@1.1.2\ntracker@1.1.3\nui@1.0.13\nunderscore@1.0.10\nurl@1.1.0\nwebapp@1.3.19\nwebapp-hashing@1.0.9\n"
  },
  {
    "path": "core/test/server/methods.js",
    "content": "Meteor.methods({\n    echo: function () {\n        return _.toArray(arguments);\n    },\n    disconnectMe: function () {\n        this.connection.close();\n    }\n});\n"
  },
  {
    "path": "core/test/server/publications.js",
    "content": "Meteor.publish(\"echo\", function () {\n    var self = this;\n    _.each(arguments, function (param, index) {\n        self.added(\"echoParameters\", \"id_\" + index, {param: param});\n    });\n    self.ready();\n});\n\nMeteor.publish(\"autoTerminating\", function () {\n    var self = this;\n    self.added(\"autoTerminating\", \"id\", {});\n    self.ready();\n    setTimeout(function () {\n        self.stop();\n    }, 1000);\n});\n"
  },
  {
    "path": "core/test/unit/ddp.js",
    "content": "import chai, {expect} from \"chai\";\nimport sinon from \"sinon\";\nimport sinonChai from \"sinon-chai\";\n\nchai.use(sinonChai);\n\nimport DDP from \"../../src/ddp\";\nimport Socket from \"../../src/socket\";\n\nclass SocketConstructorMock {\n    send () {}\n    close () {}\n}\nconst options = {\n    SocketConstructor: SocketConstructorMock\n};\n\ndescribe(\"`DDP` class\", () => {\n\n    describe(\"`constructor` method\", () => {\n\n        beforeEach(() => {\n            sinon.stub(Socket.prototype, \"on\");\n            sinon.stub(Socket.prototype, \"open\");\n        });\n        afterEach(() => {\n            Socket.prototype.on.restore();\n            Socket.prototype.open.restore();\n        });\n\n        it(\"instantiates a `Socket`\", () => {\n            const ddp = new DDP(options);\n            expect(ddp.socket).to.be.an.instanceOf(Socket);\n        });\n\n        it(\"registers handlers for `socket` events\", () => {\n            const ddp = new DDP(options);\n            expect(ddp.socket.on).to.have.always.been.calledWithMatch(\n                sinon.match.string,\n                sinon.match.func\n            );\n        });\n\n        it(\"opens a connection to the server (by calling `socket.open`) unless `options.autoConnect === false`\", () => {\n            const ddp = new DDP(options);\n            expect(ddp.socket.open).to.have.callCount(1);\n        });\n\n        it(\"does not open a connection when `options.autoConnect === false`\", () => {\n            const ddp = new DDP({\n                ...options,\n                autoConnect: false\n            });\n            expect(ddp.socket.open).to.have.callCount(0);\n        });\n\n        it(\"sets the instance `reconnectInterval` to `options.reconnectInterval` if specified\", () => {\n            const ddp = new DDP({\n                ...options,\n                reconnectInterval: 1,\n                autoConnect: false\n            });\n            expect(ddp.reconnectInterval).to.equal(1);\n        });\n\n        it(\"sets the instance `reconnectInterval` to a default value if `options.reconnectInterval` is not specified\", () => {\n            const ddp = new DDP({\n                ...options,\n                autoConnect: false\n            });\n            expect(ddp.reconnectInterval).to.equal(10000);\n        });\n\n\n    });\n\n    describe(\"`method` method\", () => {\n\n        it(\"sends a DDP `method` message\", () => {\n            const ddp = new DDP(options);\n            ddp.messageQueue.push = sinon.spy();\n            const id = ddp.method(\"name\", [\"param\"]);\n            expect(ddp.messageQueue.push).to.have.been.calledWith({\n                msg: \"method\",\n                id: id,\n                method: \"name\",\n                params: [\"param\"]\n            });\n        });\n\n        it(\"returns the method's `id`\", () => {\n            const ddp = new DDP(options);\n            ddp.messageQueue.push = sinon.spy();\n            const id = ddp.method(\"name\", [\"param\"]);\n            expect(id).to.be.a(\"string\");\n        });\n\n    });\n\n    describe(\"`sub` method\", () => {\n\n        it(\"sends a DDP `sub` message\", () => {\n            const ddp = new DDP(options);\n            ddp.messageQueue.push = sinon.spy();\n            const id = ddp.sub(\"name\", [\"param\"]);\n            expect(ddp.messageQueue.push).to.have.been.calledWith({\n                msg: \"sub\",\n                id: id,\n                name: \"name\",\n                params: [\"param\"]\n            });\n        });\n\n        it(\"returns the sub's `id`\", () => {\n            const ddp = new DDP(options);\n            ddp.messageQueue.push = sinon.spy();\n            const id = ddp.sub(\"name\", [\"param\"]);\n            expect(id).to.be.a(\"string\");\n        });\n\n        it(\"generates unique id when not specified\", () => {\n            const ddp = new DDP(options);\n            var ids = [];\n            ids.push(ddp.sub(\"echo\", [ 0 ]));\n            ids.push(ddp.sub(\"echo\", [ 0 ]));\n            expect(ids[0]).to.be.a(\"string\");\n            expect(ids[1]).to.be.a(\"string\");\n            expect(ids[0]).not.to.equal(ids[1]);\n        });\n\n        it(\"allows manually specifying sub's id\", () => {\n            const ddp = new DDP(options);\n            const subId = ddp.sub(\"echo\", [ 0 ], \"12345\");\n            expect(subId).to.equal(\"12345\");\n        });\n\n    });\n\n    describe(\"`unsub` method\", () => {\n\n        it(\"sends a DDP `unsub` message\", () => {\n            const ddp = new DDP(options);\n            ddp.messageQueue.push = sinon.spy();\n            const id = ddp.unsub(\"id\");\n            expect(ddp.messageQueue.push).to.have.been.calledWith({\n                msg: \"unsub\",\n                id: id\n            });\n        });\n\n        it(\"returns the sub's `id`\", () => {\n            const ddp = new DDP(options);\n            ddp.messageQueue.push = sinon.spy();\n            const id = ddp.unsub(\"id\");\n            expect(id).to.be.a(\"string\");\n            expect(id).to.equal(\"id\");\n        });\n\n    });\n\n    describe(\"`connect` method\", () => {\n\n        beforeEach(() => {\n            sinon.stub(Socket.prototype, \"open\");\n        });\n        afterEach(() => {\n            Socket.prototype.open.restore();\n        });\n\n        it(\"opens the WebSocket connection\", () => {\n            const ddp = new DDP(options);\n            Socket.prototype.open.reset();\n            ddp.connect();\n            expect(ddp.socket.open).to.have.callCount(1);\n        });\n\n    });\n\n    describe(\"`disconnect` method\", () => {\n\n        beforeEach(() => {\n            sinon.stub(Socket.prototype, \"close\");\n        });\n        afterEach(() => {\n            Socket.prototype.close.restore();\n        });\n\n        it(\"closes the WebSocket connection\", () => {\n            const ddp = new DDP(options);\n            ddp.disconnect();\n            expect(ddp.socket.close).to.have.callCount(1);\n        });\n\n        it(\"sets the `autoReconnect` flag to false\", () => {\n            const ddp = new DDP(options);\n            ddp.disconnect();\n            expect(ddp.autoReconnect).to.equal(false);\n        });\n\n    });\n\n    describe(\"`socket` `open` handler\", () => {\n\n        beforeEach(() => {\n            sinon.stub(global, \"setTimeout\").callsFake(fn => fn());\n        });\n        afterEach(() => {\n            global.setTimeout.restore();\n        });\n\n        it(\"sends the `connect` DDP message\", () => {\n            const ddp = new DDP(options);\n            ddp.socket.send = sinon.spy();\n            ddp.socket.emit(\"open\");\n            expect(ddp.socket.send).to.have.been.calledWith({\n                msg: \"connect\",\n                version: \"1\",\n                support: [\"1\"]\n            });\n        });\n\n    });\n\n    describe(\"`socket` `close` handler\", () => {\n\n        beforeEach(() => {\n            sinon.stub(global, \"setTimeout\").callsFake(fn => fn());\n        });\n        afterEach(() => {\n            global.setTimeout.restore();\n        });\n\n        it(\"emits the `disconnected` event if was 'connected'\", () => {\n            const ddp = new DDP(options);\n            ddp.status = \"connected\";\n            ddp.emit = sinon.spy();\n            ddp.socket.emit(\"close\");\n            expect(ddp.emit).to.have.been.calledWith(\"disconnected\");\n        });\n\n        it(\"sets the status to `disconnected`\", () => {\n            const ddp = new DDP(options);\n            ddp.status = \"connected\";\n            ddp.emit = sinon.spy();\n            ddp.socket.emit(\"close\");\n            expect(ddp.status).to.equal(\"disconnected\");\n        });\n\n        it(\"schedules a reconnection unless `options.autoReconnect === false`\", () => {\n            const ddp = new DDP(options);\n            ddp.socket.open = sinon.spy();\n            ddp.socket.emit(\"close\");\n            expect(ddp.socket.open).to.have.callCount(1);\n        });\n\n        it(\"doesn't schedule a reconnection when `options.autoReconnect === false`\", () => {\n            const ddp = new DDP({\n                ...options,\n                autoReconnect: false\n            });\n            ddp.socket.open = sinon.spy();\n            ddp.socket.emit(\"close\");\n            expect(ddp.socket.open).to.have.callCount(0);\n        });\n\n    });\n\n    describe(\"`socket` `message:in` handler\", () => {\n\n        beforeEach(() => {\n            sinon.stub(global, \"setTimeout\").callsFake(fn => fn());\n        });\n        afterEach(() => {\n            global.setTimeout.restore();\n        });\n\n        it(\"responds to `ping` DDP messages\", () => {\n            const ddp = new DDP(options);\n            ddp.socket.send = sinon.spy();\n            ddp.socket.emit(\"message:in\", {\n                id: \"id\",\n                msg: \"ping\"\n            });\n            expect(ddp.socket.send).to.have.been.calledWith({\n                id: \"id\",\n                msg: \"pong\"\n            });\n        });\n\n        it(\"triggers `messageQueue` processing upon connection\", () => {\n            const ddp = new DDP(options);\n            ddp.emit = sinon.spy();\n            ddp.messageQueue.process = sinon.spy();\n            ddp.socket.emit(\"message:in\", {msg: \"connected\"});\n            expect(ddp.messageQueue.process).to.have.callCount(1);\n        });\n\n        it(\"sets the status to `connected` upon connection\", () => {\n            const ddp = new DDP(options);\n            ddp.emit = sinon.spy();\n            ddp.socket.emit(\"message:in\", {msg: \"connected\"});\n            expect(ddp.status).to.equal(\"connected\");\n        });\n\n        it(\"emits public DDP messages as events\", () => {\n            const ddp = new DDP(options);\n            ddp.emit = sinon.spy();\n            const message = {\n                id: \"id\",\n                msg: \"result\"\n            };\n            ddp.socket.emit(\"message:in\", message);\n            expect(ddp.emit).to.have.been.calledWith(\"result\", message);\n        });\n\n        it(\"ignores unknown (or non public) DDP messages\", () => {\n            const ddp = new DDP(options);\n            ddp.emit = sinon.spy();\n            const message = {\n                id: \"id\",\n                msg: \"not-a-ddp-message\"\n            };\n            ddp.socket.emit(\"message:in\", message);\n            expect(ddp.emit).to.have.callCount(0);\n        });\n\n    });\n\n    describe(\"`messageQueue` consumer\", () => {\n\n        it(\"acks if `status` is `connected`\", () => {\n            const ddp = new DDP(options);\n            ddp.status = \"connected\";\n            const ack = ddp.messageQueue.consumer({});\n            expect(ack).to.equal(true);\n        });\n\n        it(\"doesn't ack if `status` is `disconnected`\", () => {\n            const ddp = new DDP(options);\n            ddp.status = \"disconnected\";\n            const ack = ddp.messageQueue.consumer({});\n            expect(ack).to.equal(false);\n        });\n\n    });\n\n});\n"
  },
  {
    "path": "core/test/unit/queue.js",
    "content": "import chai, {expect} from \"chai\";\nimport sinon from \"sinon\";\nimport sinonChai from \"sinon-chai\";\n\nchai.use(sinonChai);\n\nimport Queue from \"../../src/queue\";\n\ndescribe(\"`Queue` class\", () => {\n\n    describe(\"`push` method\", () => {\n\n        it(\"adds an element to the queue\", () => {\n            const q = new Queue();\n            q.process = sinon.spy();\n            const element = {};\n            q.push(element);\n            expect(q.queue).to.include(element);\n        });\n\n        it(\"triggers processing\", () => {\n            const q = new Queue();\n            q.process = sinon.spy();\n            const element = {};\n            q.push(element);\n            expect(q.process).to.have.callCount(1);\n        });\n\n    });\n\n    describe(\"`process` method\", () => {\n\n        it(\"calls the consumer on each element of the queue\", () => {\n            const consumer = sinon.spy(() => true);\n            const q = new Queue(consumer);\n            q.queue = [0, 1, 2];\n            q.process();\n            expect(consumer).to.have.been.calledWith(0);\n            expect(consumer).to.have.been.calledWith(1);\n            expect(consumer).to.have.been.calledWith(2);\n            expect(consumer).to.have.callCount(3);\n        });\n\n        it(\"removes elements from the queue\", () => {\n            const consumer = sinon.spy(() => true);\n            const q = new Queue(consumer);\n            q.queue = [0, 1, 2];\n            q.process();\n            expect(q.queue.length).to.equal(0);\n        });\n\n        it(\"doesn't remove elements from the queue if the consumer doesn't ack\", () => {\n            const consumer = sinon.spy(() => false);\n            const q = new Queue(consumer);\n            q.queue = [0, 1, 2];\n            q.process();\n            expect(consumer).to.have.been.calledWith(0);\n            expect(consumer).to.have.callCount(1);\n            expect(q.queue.length).to.equal(3);\n        });\n\n    });\n\n    describe(\"`empty` method\", () => {\n\n        it(\"empties the queue\", () => {\n            const q = new Queue();\n            q.process = sinon.spy();\n            const element = {};\n            q.push(element);\n            expect(q.queue.length).to.equal(1);\n            q.empty();\n            expect(q.queue.length).to.equal(0);\n        });\n\n    });\n\n\n});\n"
  },
  {
    "path": "core/test/unit/socket.js",
    "content": "import chai, {expect} from \"chai\";\nimport sinon from \"sinon\";\nimport sinonChai from \"sinon-chai\";\n\nchai.use(sinonChai);\n\nimport Socket from \"../../src/socket\";\nimport EJSON from \"ejson\";\n\nclass SocketConstructorMock {\n    close () {}\n    send () {}\n}\n\ndescribe(\"`Socket` class\", () => {\n\n    describe(\"`send` method\", () => {\n\n        it(\"sends a message through the `rawSocket`\", () => {\n            const socket = new Socket();\n            socket.rawSocket = {\n                send: sinon.spy()\n            };\n            socket.send({});\n            expect(socket.rawSocket.send).to.have.callCount(1);\n        });\n\n        it(\"stringifies the object to send\", () => {\n            const socket = new Socket();\n            socket.rawSocket = {\n                send: sinon.spy()\n            };\n            const object = {\n                a: \"a\"\n            };\n            const expectedMessage = EJSON.stringify(object);\n            socket.send(object);\n            expect(socket.rawSocket.send).to.have.been.calledWith(expectedMessage);\n        });\n\n        it(\"emits a `message:out` event\", () => {\n            const socket = new Socket();\n            socket.rawSocket = {\n                send: sinon.spy()\n            };\n            socket.emit = sinon.spy();\n            const object = {\n                a: \"a\"\n            };\n            socket.send(object);\n            expect(socket.emit).to.have.been.calledWith(\"message:out\", object);\n        });\n\n    });\n\n    describe(\"`open` method\", () => {\n\n        it(\"no-op if `rawSocket` is already defined\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            const rawSocket = {};\n            socket.rawSocket = rawSocket;\n            socket.open();\n            // Test, for instance, that `rawSocket` has not been replaced.\n            expect(socket.rawSocket).to.equal(rawSocket);\n        });\n\n        it(\"instantiates a `SocketConstructor`\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            socket.open();\n            expect(socket.rawSocket).to.be.an.instanceOf(SocketConstructorMock);\n        });\n\n        it(\"registers handlers for `rawSocket` events\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            socket.open();\n            expect(socket.rawSocket.onopen).to.be.a(\"function\");\n            expect(socket.rawSocket.onclose).to.be.a(\"function\");\n            expect(socket.rawSocket.onerror).to.be.a(\"function\");\n            expect(socket.rawSocket.onmessage).to.be.a(\"function\");\n        });\n\n    });\n\n    describe(\"`close` method\", () => {\n\n        it(\"closes the `rawSocket`\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            socket.open();\n            socket.rawSocket.close = sinon.spy();\n            socket.close();\n            expect(socket.rawSocket.close).to.have.callCount(1);\n        });\n\n        it(\"doesn't throw if there's no `rawSocket`\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            const peacemaker = () => {\n                socket.close();\n            };\n            expect(peacemaker).not.to.throw();\n        });\n\n    });\n\n    describe(\"`rawSocket` `onopen` handler\", () => {\n\n        it(\"emits an `open` event\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            const handler = sinon.spy();\n            socket.on(\"open\", handler);\n            socket.open();\n            socket.rawSocket.onopen();\n            expect(handler).to.have.callCount(1);\n        });\n\n    });\n\n    describe(\"`rawSocket` `onclose` handler\", () => {\n\n        it(\"emits a `close` event\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            const handler = sinon.spy();\n            socket.on(\"close\", handler);\n            socket.open();\n            socket.rawSocket.onclose();\n            expect(handler).to.have.callCount(1);\n        });\n\n        it(\"null-s the `rawSocket` property\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            socket.open();\n            socket.rawSocket.onclose();\n            expect(socket.rawSocket).to.equal(null);\n        });\n\n    });\n\n    describe(\"`rawSocket` `onerror` handler\", () => {\n\n        it(\"closes `rawSocket` (by calling `rawSocket.close`)\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            socket.open();\n            const rawSocket = socket.rawSocket;\n            rawSocket.close = sinon.spy();\n            socket.rawSocket.onerror();\n            expect(rawSocket.close).to.have.callCount(1);\n        });\n\n        it(\"de-registers the `rawSocket.onclose` callback\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            socket.open();\n            const rawSocket = socket.rawSocket;\n            expect(rawSocket).to.have.property(\"onclose\");\n            socket.rawSocket.onerror();\n            expect(rawSocket).not.to.have.property(\"onclose\");\n        });\n\n        it(\"emits a `close` event\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            const handler = sinon.spy();\n            socket.on(\"close\", handler);\n            socket.open();\n            socket.rawSocket.onerror();\n            expect(handler).to.have.callCount(1);\n        });\n\n        it(\"null-s the `rawSocket` property\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            socket.open();\n            socket.rawSocket.onerror();\n            expect(socket.rawSocket).to.equal(null);\n        });\n\n    });\n\n    describe(\"`rawSocket` `onmessage` handler\", () => {\n\n        it(\"parses message data into an object\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            sinon.stub(EJSON, \"parse\");\n            socket.open();\n            socket.rawSocket.onmessage({data: \"message\"});\n            expect(EJSON.parse).to.have.been.calledWith(\"message\");\n            EJSON.parse.restore();\n        });\n\n        it(\"ignores malformed messages\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            sinon.stub(EJSON, \"parse\").throws();\n            socket.open();\n            expect(socket.rawSocket.onmessage).not.to.throw();\n            EJSON.parse.restore();\n        });\n\n        it(\"parses correctly EJSON-specific data types\", function () {\n            var socket = new Socket(SocketConstructorMock);\n            var testDate = new Date();\n            sinon.stub(EJSON, \"parse\");\n            socket.open();\n            socket.rawSocket.onmessage({data: testDate});\n            expect(EJSON.parse).to.have.been.calledWith(testDate);\n            EJSON.parse.restore();\n        });\n\n        it(\"emits `message:in` events\", () => {\n            const socket = new Socket(SocketConstructorMock);\n            const handler = sinon.spy();\n            socket.on(\"message:in\", handler);\n            socket.open();\n            socket.rawSocket.onmessage({data: EJSON.stringify({a: \"a\"})});\n            expect(handler).to.have.callCount(1);\n            expect(handler).to.have.been.calledWith({a: \"a\"});\n        });\n\n    });\n\n});\n"
  },
  {
    "path": "core/test/unit/utils.js",
    "content": "import {expect} from \"chai\";\n\nimport {contains, uniqueId} from \"../../src/utils\";\n\ndescribe(\"`utils` object\", () => {\n\n    describe(\"`contains` function\", () => {\n\n        it(\"returns true if the first parameter contains the second parameter\", () => {\n            const array = [\"element\"];\n            const element = \"element\";\n            expect(contains(array, element)).to.equal(true);\n        });\n\n        it(\"returns false if the first parameter doesn't contain the second parameter\", () => {\n            const array = [\"element\"];\n            const element = \"different-element\";\n            expect(contains(array, element)).to.equal(false);\n        });\n\n    });\n\n    describe(\"`uniqueId` function\", () => {\n\n        it(\"should return a different string each time it's called\", () => {\n            const ret1 = uniqueId();\n            const ret2 = uniqueId();\n            expect(ret1).not.to.equal(ret2);\n        });\n\n    });\n\n});\n"
  },
  {
    "path": "custom_ejson.md",
    "content": "# Adding custom EJSON types\n\nAdding custom EJSON types is as simple as it is in Meteor.\nFirst install `ejson` package:\n\n`npm install ejson --save`\n\nImport/require `EJSON`.\n\n```javascript\nconst EJSON = require(\"ejson\"); // nodejs\n```\n\nor\n\n```javascript\nimport EJSON from 'ejson'; // ES6\n```\n\nAnd use method `addType`\n\n```javascript\nclass Distance {\n  constructor(value, unit) {\n    this.value = value;\n    this.unit = unit;\n  }\n\n  // Convert our type to JSON.\n  toJSONValue() {\n    return {\n      value: this.value,\n      unit: this.unit\n    };\n  }\n\n  // Unique type name.\n  typeName() {\n    return 'Distance';\n  }\n}\n\nEJSON.addType('Distance', function fromJSONValue(json) {\n  return new Distance(json.value, json.unit);\n});\n```\n\n*Don't forget to do the same as above in the server side code!*\n\n[Read more in Meteor Docs](https://docs.meteor.com/api/ejson.html)\n\n## Example, adding Decimal support\n\n`npm install ejson decimal.js --save`\n\n```javascript\n// ejson_decimal.js\nimport EJSON from 'ejson';\nimport Decimal from 'decimal.js';\n\nDecimal.prototype.typeName = function() {\n  return 'Decimal';\n};\n\nDecimal.prototype.toJSONValue = function () {\n  return this.toJSON();\n};\n\nDecimal.prototype.clone = function () {\n  return Decimal(this.toString());\n};\n\nEJSON.addType('Decimal', function (str) {\n  return Decimal(str);\n});\n\nexport { Decimal };\n\n// now you can use Decimal in your method calls, subscriptions\n// and all the 'Decimal' data from server will be converted to Decimal object on client\n```\n\n## Example, adding MongoId support\n\n`npm install ejson decimal.js --save`\n\n```javascript\n// ejson_decimal.js\nimport EJSON from 'ejson';\n\nclass MongoObjectId {\n  constructor(str) {\n    this.str = str;\n  }\n\n  // Convert our type to JSON.\n  toJSONValue() {\n    return this.value();\n  }\n\n  // Unique type name.\n  typeName() {\n    return 'oid';\n  }\n\n  value() {\n    return this.str;\n  }\n}\n\nEJSON.addType('oid', function fromJSONValue(str) {\n  return new MongoObjectId(str);\n});\n\nexport { MongoObjectId };\n```\n"
  },
  {
    "path": "docs/ddpCollection.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>SimpleDDP Docs</title>\n    \n    <meta name=\"description\" content=\"SimpleDDP Docs\" />\n    \n        <meta name=\"keywords\" content=\"ddp, simpleddp, websocket, meteor\" />\n        <meta name=\"keyword\" content=\"ddp, simpleddp, websocket, meteor\" />\n    \n    \n    \n    <meta property=\"og:title\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og:image\" content=\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\"/>\n    <meta property=\"og:site_name\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:url\" content=\"\"/>\n    \n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <script src=\"scripts/prettify/prettify.js\"></script>\n    <script src=\"scripts/prettify/lang-css.js\"></script>\n    <script src=\"scripts/jquery.min.js\"></script>\n    <!--[if lt IE 9]>\n      <script src=\"//html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n    <link href=\"https://fonts.googleapis.com/css?family=Libre+Franklin:400,700\" rel=\"stylesheet\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/prettify-tomorrow.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/bootstrap.min.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/main.css\">\n    \n    \n    <script>\n    var config = {\"monospaceLinks\":false,\"cleverLinks\":false,\"applicationName\":\"SimpleDDP\",\"disqus\":\"\",\"googleAnalytics\":\"\",\"openGraph\":{\"title\":\"SimpleDDP Docs\",\"type\":\"website\",\"image\":\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\"site_name\":\"SimpleDDP Docs\",\"url\":\"\"},\"meta\":{\"title\":\"SimpleDDP Docs\",\"description\":\"SimpleDDP Docs\",\"keyword\":\"ddp, simpleddp, websocket, meteor\"},\"linenums\":true,\"default\":{}};\n    </script>\n    \n\n    \n</head>\n<body>\n<div id=\"wrap\" class=\"clearfix\">\n    \n<div class=\"navigation\">\n    <h3 class=\"applicationName\"><a href=\"index.html\">SimpleDDP</a></h3>\n    <button id=\"menuToggle\" class=\"btn btn-link btn-lg menu-toggle\">\n        <span class=\"glyphicon glyphicon-menu-hamburger\"></span>\n    </button>\n    <div class=\"search\">\n        <input id=\"search\" type=\"text\" class=\"form-control input-md\" placeholder=\"Search...\">\n    </div>\n    <ul class=\"list\">\n    \n        <li class=\"item\" data-name=\"ddpCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpCollection.html\">ddpCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#exportData\"><a href=\"ddpCollection.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#fetch\"><a href=\"ddpCollection.html#fetch\">fetch</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#filter\"><a href=\"ddpCollection.html#filter\">filter</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#importData\"><a href=\"ddpCollection.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#onChange\"><a href=\"ddpCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#reactive\"><a href=\"ddpCollection.html#reactive\">reactive</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpEventListener\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpEventListener.html\">ddpEventListener</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#start\"><a href=\"ddpEventListener.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#stop\"><a href=\"ddpEventListener.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpOnChange\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpOnChange.html\">ddpOnChange</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#start\"><a href=\"ddpOnChange.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#stop\"><a href=\"ddpOnChange.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#_updateReactiveObjects\"><a href=\"ddpReactiveCollection.html#_updateReactiveObjects\">_updateReactiveObjects</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#count\"><a href=\"ddpReactiveCollection.html#count\">count</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#data\"><a href=\"ddpReactiveCollection.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#map\"><a href=\"ddpReactiveCollection.html#map\">map</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#onChange\"><a href=\"ddpReactiveCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#one\"><a href=\"ddpReactiveCollection.html#one\">one</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#reduce\"><a href=\"ddpReactiveCollection.html#reduce\">reduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#settings\"><a href=\"ddpReactiveCollection.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#sort\"><a href=\"ddpReactiveCollection.html#sort\">sort</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#start\"><a href=\"ddpReactiveCollection.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#stop\"><a href=\"ddpReactiveCollection.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveDocument\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#data\"><a href=\"ddpReactiveDocument.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#onChange\"><a href=\"ddpReactiveDocument.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#settings\"><a href=\"ddpReactiveDocument.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#start\"><a href=\"ddpReactiveDocument.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#stop\"><a href=\"ddpReactiveDocument.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReducer\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReducer.html\">ddpReducer</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#data\"><a href=\"ddpReducer.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#doReduce\"><a href=\"ddpReducer.html#doReduce\">doReduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#onChange\"><a href=\"ddpReducer.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#start\"><a href=\"ddpReducer.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#stop\"><a href=\"ddpReducer.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpSubscription\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpSubscription.html\">ddpSubscription</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isOn\"><a href=\"ddpSubscription.html#isOn\">isOn</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isReady\"><a href=\"ddpSubscription.html#isReady\">isReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isStopped\"><a href=\"ddpSubscription.html#isStopped\">isStopped</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#nosub\"><a href=\"ddpSubscription.html#nosub\">nosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onNosub\"><a href=\"ddpSubscription.html#onNosub\">onNosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onReady\"><a href=\"ddpSubscription.html#onReady\">onReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#ready\"><a href=\"ddpSubscription.html#ready\">ready</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#remove\"><a href=\"ddpSubscription.html#remove\">remove</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#restart\"><a href=\"ddpSubscription.html#restart\">restart</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#start\"><a href=\"ddpSubscription.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#stop\"><a href=\"ddpSubscription.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"simpleDDP\">\n            <span class=\"title  \">\n                \n                <a href=\"simpleDDP.html\">simpleDDP</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            <span class=\"subtitle\">Members</span>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#collections\"><a href=\"simpleDDP.html#collections\">collections</a></li>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#connected\"><a href=\"simpleDDP.html#connected\">connected</a></li>\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#apply\"><a href=\"simpleDDP.html#apply\">apply</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#call\"><a href=\"simpleDDP.html#call\">call</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#clearData\"><a href=\"simpleDDP.html#clearData\">clearData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#collection\"><a href=\"simpleDDP.html#collection\">collection</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#connect\"><a href=\"simpleDDP.html#connect\">connect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#disconnect\"><a href=\"simpleDDP.html#disconnect\">disconnect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#exportData\"><a href=\"simpleDDP.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#importData\"><a href=\"simpleDDP.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#markAsReady\"><a href=\"simpleDDP.html#markAsReady\">markAsReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#on\"><a href=\"simpleDDP.html#on\">on</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#stopChangeListeners\"><a href=\"simpleDDP.html#stopChangeListeners\">stopChangeListeners</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#sub\"><a href=\"simpleDDP.html#sub\">sub</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#subscribe\"><a href=\"simpleDDP.html#subscribe\">subscribe</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n    </ul>\n</div>\n    <div class=\"main\">\n        <h1 class=\"page-title\" data-filename=\"ddpCollection.html\">Class: ddpCollection</h1>\n        \n\n\n\n<section>\n    \n<header>\n    <div class=\"header content-size\">\n        <h2>ddpCollection\n        </h2>\n        \n            <div class=\"class-description\"><p>DDP collection class.</p></div>\n        \n    </div>\n</header>  \n\n<article class=\"content-size\">\n    <div class=\"container-overview\">\n    \n    \n    \n        \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"ddpCollection\">\n            <a class=\"share-icon\" href=\"#ddpCollection\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                new ddpCollection\n            </span>\n            <span class=\"signature\">(name, server)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>name</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">String</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Collection name.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>server</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"simpleDDP.html\">simpleDDP</a></span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>simpleDDP instance.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n    \n    </div>\n    \n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Classes</h3>\n        \n        <dl class=\"clearfix summary-list list-classes\">\n            <dt class=\"\"><a href=\"ddpCollection.html\">ddpCollection</a></dt>\n            \n        </dl>\n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Methods</h3>\n        \n        <dl class=\"list-methods\">\n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"exportData\">\n            <a class=\"share-icon\" href=\"#exportData\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                exportData\n            </span>\n            <span class=\"signature\">(<span class=\"optional\">format</span>)</span><span class=\"type-signature\">string | Object</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Exports data from the collection.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>format</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    'string'\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>If 'string' then returns EJSON string, if 'raw' returns js object.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        string\n                         | \n                    \n                        Object\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"fetch\">\n            <a class=\"share-icon\" href=\"#fetch\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                fetch\n            </span>\n            <span class=\"signature\">(<span class=\"optional\">settings</span>)</span><span class=\"type-signature\">Object</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns collection data based on filter and on passed settings. Supports skip, limit and sort.\nOrder is 'filter' then 'sort' then 'skip' then 'limit'.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>settings</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    {skip:0,limit:Infinity,sort:null}\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Skip and limit are numbers or Infinity,\nsort is a standard js array sort function.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Object\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"filter\">\n            <a class=\"share-icon\" href=\"#filter\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                filter\n            </span>\n            <span class=\"signature\">(f)</span><span class=\"type-signature\">this</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Allows to specify specific documents inside the collection for reactive data and fetching.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Filter function, recieves as arguments object, index and array.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        this\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"importData\">\n            <a class=\"share-icon\" href=\"#importData\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                importData\n            </span>\n            <span class=\"signature\">(data)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Imports data inside the collection and emits all relevant events.\nBoth string and JS object types are supported.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>data</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n|\n\n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>EJSON string or EJSON or js object.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"onChange\">\n            <a class=\"share-icon\" href=\"#onChange\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                onChange\n            </span>\n            <span class=\"signature\">(f, filter)</span><span class=\"type-signature\">Object</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns change observer.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                </td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>filter</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                </td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    <dt class=\"tag-see\">See:</dt>\n    <dd class=\"tag-see\">\n        <ul>\n            <li><a href=\"ddpOnChange.html\">ddpOnChange</a></li>\n        </ul>\n    </dd>\n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Object\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>@see ddpOnChange</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"reactive\">\n            <a class=\"share-icon\" href=\"#reactive\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                reactive\n            </span>\n            <span class=\"signature\">(<span class=\"optional\">settings</span>)</span><span class=\"type-signature\">Object</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns reactive collection object.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>settings</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    {skip:0,limit:Infinity,sort:null}\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                </td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    <dt class=\"tag-see\">See:</dt>\n    <dd class=\"tag-see\">\n        <ul>\n            <li><a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a></li>\n        </ul>\n    </dd>\n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Object\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>@see ddpReactiveCollection</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        </dl>\n    \n    \n    \n    \n    \n\n    \n</article>\n\n</section>  \n\n\n\n\n\n        \n\n        <footer class=\"content-size\">\n            <div class=\"footer\">\n                Documentation generated by <a target=\"_blank\" href=\"https://github.com/jsdoc3/jsdoc\">JSDoc 3.6.3</a> on Wed Aug 07 2019 02:35:33 GMT+0300 (MSK)\n            </div>\n        </footer>\n    </div>\n</div>\n<script>prettyPrint();</script>\n<script src=\"scripts/main.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "docs/ddpEventListener.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>SimpleDDP Docs</title>\n    \n    <meta name=\"description\" content=\"SimpleDDP Docs\" />\n    \n        <meta name=\"keywords\" content=\"ddp, simpleddp, websocket, meteor\" />\n        <meta name=\"keyword\" content=\"ddp, simpleddp, websocket, meteor\" />\n    \n    \n    \n    <meta property=\"og:title\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og:image\" content=\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\"/>\n    <meta property=\"og:site_name\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:url\" content=\"\"/>\n    \n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <script src=\"scripts/prettify/prettify.js\"></script>\n    <script src=\"scripts/prettify/lang-css.js\"></script>\n    <script src=\"scripts/jquery.min.js\"></script>\n    <!--[if lt IE 9]>\n      <script src=\"//html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n    <link href=\"https://fonts.googleapis.com/css?family=Libre+Franklin:400,700\" rel=\"stylesheet\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/prettify-tomorrow.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/bootstrap.min.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/main.css\">\n    \n    \n    <script>\n    var config = {\"monospaceLinks\":false,\"cleverLinks\":false,\"applicationName\":\"SimpleDDP\",\"disqus\":\"\",\"googleAnalytics\":\"\",\"openGraph\":{\"title\":\"SimpleDDP Docs\",\"type\":\"website\",\"image\":\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\"site_name\":\"SimpleDDP Docs\",\"url\":\"\"},\"meta\":{\"title\":\"SimpleDDP Docs\",\"description\":\"SimpleDDP Docs\",\"keyword\":\"ddp, simpleddp, websocket, meteor\"},\"linenums\":true,\"default\":{}};\n    </script>\n    \n\n    \n</head>\n<body>\n<div id=\"wrap\" class=\"clearfix\">\n    \n<div class=\"navigation\">\n    <h3 class=\"applicationName\"><a href=\"index.html\">SimpleDDP</a></h3>\n    <button id=\"menuToggle\" class=\"btn btn-link btn-lg menu-toggle\">\n        <span class=\"glyphicon glyphicon-menu-hamburger\"></span>\n    </button>\n    <div class=\"search\">\n        <input id=\"search\" type=\"text\" class=\"form-control input-md\" placeholder=\"Search...\">\n    </div>\n    <ul class=\"list\">\n    \n        <li class=\"item\" data-name=\"ddpCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpCollection.html\">ddpCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#exportData\"><a href=\"ddpCollection.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#fetch\"><a href=\"ddpCollection.html#fetch\">fetch</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#filter\"><a href=\"ddpCollection.html#filter\">filter</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#importData\"><a href=\"ddpCollection.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#onChange\"><a href=\"ddpCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#reactive\"><a href=\"ddpCollection.html#reactive\">reactive</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpEventListener\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpEventListener.html\">ddpEventListener</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#start\"><a href=\"ddpEventListener.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#stop\"><a href=\"ddpEventListener.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpOnChange\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpOnChange.html\">ddpOnChange</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#start\"><a href=\"ddpOnChange.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#stop\"><a href=\"ddpOnChange.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#_updateReactiveObjects\"><a href=\"ddpReactiveCollection.html#_updateReactiveObjects\">_updateReactiveObjects</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#count\"><a href=\"ddpReactiveCollection.html#count\">count</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#data\"><a href=\"ddpReactiveCollection.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#map\"><a href=\"ddpReactiveCollection.html#map\">map</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#onChange\"><a href=\"ddpReactiveCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#one\"><a href=\"ddpReactiveCollection.html#one\">one</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#reduce\"><a href=\"ddpReactiveCollection.html#reduce\">reduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#settings\"><a href=\"ddpReactiveCollection.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#sort\"><a href=\"ddpReactiveCollection.html#sort\">sort</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#start\"><a href=\"ddpReactiveCollection.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#stop\"><a href=\"ddpReactiveCollection.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveDocument\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#data\"><a href=\"ddpReactiveDocument.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#onChange\"><a href=\"ddpReactiveDocument.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#settings\"><a href=\"ddpReactiveDocument.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#start\"><a href=\"ddpReactiveDocument.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#stop\"><a href=\"ddpReactiveDocument.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReducer\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReducer.html\">ddpReducer</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#data\"><a href=\"ddpReducer.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#doReduce\"><a href=\"ddpReducer.html#doReduce\">doReduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#onChange\"><a href=\"ddpReducer.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#start\"><a href=\"ddpReducer.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#stop\"><a href=\"ddpReducer.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpSubscription\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpSubscription.html\">ddpSubscription</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isOn\"><a href=\"ddpSubscription.html#isOn\">isOn</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isReady\"><a href=\"ddpSubscription.html#isReady\">isReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isStopped\"><a href=\"ddpSubscription.html#isStopped\">isStopped</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#nosub\"><a href=\"ddpSubscription.html#nosub\">nosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onNosub\"><a href=\"ddpSubscription.html#onNosub\">onNosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onReady\"><a href=\"ddpSubscription.html#onReady\">onReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#ready\"><a href=\"ddpSubscription.html#ready\">ready</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#remove\"><a href=\"ddpSubscription.html#remove\">remove</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#restart\"><a href=\"ddpSubscription.html#restart\">restart</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#start\"><a href=\"ddpSubscription.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#stop\"><a href=\"ddpSubscription.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"simpleDDP\">\n            <span class=\"title  \">\n                \n                <a href=\"simpleDDP.html\">simpleDDP</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            <span class=\"subtitle\">Members</span>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#collections\"><a href=\"simpleDDP.html#collections\">collections</a></li>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#connected\"><a href=\"simpleDDP.html#connected\">connected</a></li>\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#apply\"><a href=\"simpleDDP.html#apply\">apply</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#call\"><a href=\"simpleDDP.html#call\">call</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#clearData\"><a href=\"simpleDDP.html#clearData\">clearData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#collection\"><a href=\"simpleDDP.html#collection\">collection</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#connect\"><a href=\"simpleDDP.html#connect\">connect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#disconnect\"><a href=\"simpleDDP.html#disconnect\">disconnect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#exportData\"><a href=\"simpleDDP.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#importData\"><a href=\"simpleDDP.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#markAsReady\"><a href=\"simpleDDP.html#markAsReady\">markAsReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#on\"><a href=\"simpleDDP.html#on\">on</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#stopChangeListeners\"><a href=\"simpleDDP.html#stopChangeListeners\">stopChangeListeners</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#sub\"><a href=\"simpleDDP.html#sub\">sub</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#subscribe\"><a href=\"simpleDDP.html#subscribe\">subscribe</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n    </ul>\n</div>\n    <div class=\"main\">\n        <h1 class=\"page-title\" data-filename=\"ddpEventListener.html\">Class: ddpEventListener</h1>\n        \n\n\n\n<section>\n    \n<header>\n    <div class=\"header content-size\">\n        <h2>ddpEventListener\n        </h2>\n        \n            <div class=\"class-description\"><p>DDP event listener class.</p></div>\n        \n    </div>\n</header>  \n\n<article class=\"content-size\">\n    <div class=\"container-overview\">\n    \n    \n    \n        \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"ddpEventListener\">\n            <a class=\"share-icon\" href=\"#ddpEventListener\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                new ddpEventListener\n            </span>\n            <span class=\"signature\">(eventname, f, ddplink)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>eventname</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">String</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Event name.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function to run when event is fired.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>ddplink</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"simpleDDP.html\">simpleDDP</a></span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>simpleDDP instance.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n    \n    </div>\n    \n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Classes</h3>\n        \n        <dl class=\"clearfix summary-list list-classes\">\n            <dt class=\"\"><a href=\"ddpEventListener.html\">ddpEventListener</a></dt>\n            \n        </dl>\n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Methods</h3>\n        \n        <dl class=\"list-methods\">\n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"start\">\n            <a class=\"share-icon\" href=\"#start\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                start\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Usually you won't need this unless you stopped the @see ddpEventListener.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    <dt class=\"tag-see\">See:</dt>\n    <dd class=\"tag-see\">\n        <ul>\n            <li>ddpEventListener starts on creation.</li>\n        </ul>\n    </dd>\n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"stop\">\n            <a class=\"share-icon\" href=\"#stop\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                stop\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Stops listening for server <code>event</code> messages.\nYou can start any stopped @see ddpEventListener at any time using <code>ddpEventListener.start()</code>.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        </dl>\n    \n    \n    \n    \n    \n\n    \n</article>\n\n</section>  \n\n\n\n\n\n        \n\n        <footer class=\"content-size\">\n            <div class=\"footer\">\n                Documentation generated by <a target=\"_blank\" href=\"https://github.com/jsdoc3/jsdoc\">JSDoc 3.6.3</a> on Wed Aug 07 2019 02:35:33 GMT+0300 (MSK)\n            </div>\n        </footer>\n    </div>\n</div>\n<script>prettyPrint();</script>\n<script src=\"scripts/main.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "docs/ddpOnChange.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>SimpleDDP Docs</title>\n    \n    <meta name=\"description\" content=\"SimpleDDP Docs\" />\n    \n        <meta name=\"keywords\" content=\"ddp, simpleddp, websocket, meteor\" />\n        <meta name=\"keyword\" content=\"ddp, simpleddp, websocket, meteor\" />\n    \n    \n    \n    <meta property=\"og:title\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og:image\" content=\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\"/>\n    <meta property=\"og:site_name\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:url\" content=\"\"/>\n    \n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <script src=\"scripts/prettify/prettify.js\"></script>\n    <script src=\"scripts/prettify/lang-css.js\"></script>\n    <script src=\"scripts/jquery.min.js\"></script>\n    <!--[if lt IE 9]>\n      <script src=\"//html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n    <link href=\"https://fonts.googleapis.com/css?family=Libre+Franklin:400,700\" rel=\"stylesheet\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/prettify-tomorrow.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/bootstrap.min.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/main.css\">\n    \n    \n    <script>\n    var config = {\"monospaceLinks\":false,\"cleverLinks\":false,\"applicationName\":\"SimpleDDP\",\"disqus\":\"\",\"googleAnalytics\":\"\",\"openGraph\":{\"title\":\"SimpleDDP Docs\",\"type\":\"website\",\"image\":\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\"site_name\":\"SimpleDDP Docs\",\"url\":\"\"},\"meta\":{\"title\":\"SimpleDDP Docs\",\"description\":\"SimpleDDP Docs\",\"keyword\":\"ddp, simpleddp, websocket, meteor\"},\"linenums\":true,\"default\":{}};\n    </script>\n    \n\n    \n</head>\n<body>\n<div id=\"wrap\" class=\"clearfix\">\n    \n<div class=\"navigation\">\n    <h3 class=\"applicationName\"><a href=\"index.html\">SimpleDDP</a></h3>\n    <button id=\"menuToggle\" class=\"btn btn-link btn-lg menu-toggle\">\n        <span class=\"glyphicon glyphicon-menu-hamburger\"></span>\n    </button>\n    <div class=\"search\">\n        <input id=\"search\" type=\"text\" class=\"form-control input-md\" placeholder=\"Search...\">\n    </div>\n    <ul class=\"list\">\n    \n        <li class=\"item\" data-name=\"ddpCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpCollection.html\">ddpCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#exportData\"><a href=\"ddpCollection.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#fetch\"><a href=\"ddpCollection.html#fetch\">fetch</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#filter\"><a href=\"ddpCollection.html#filter\">filter</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#importData\"><a href=\"ddpCollection.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#onChange\"><a href=\"ddpCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#reactive\"><a href=\"ddpCollection.html#reactive\">reactive</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpEventListener\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpEventListener.html\">ddpEventListener</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#start\"><a href=\"ddpEventListener.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#stop\"><a href=\"ddpEventListener.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpOnChange\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpOnChange.html\">ddpOnChange</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#start\"><a href=\"ddpOnChange.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#stop\"><a href=\"ddpOnChange.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#_updateReactiveObjects\"><a href=\"ddpReactiveCollection.html#_updateReactiveObjects\">_updateReactiveObjects</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#count\"><a href=\"ddpReactiveCollection.html#count\">count</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#data\"><a href=\"ddpReactiveCollection.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#map\"><a href=\"ddpReactiveCollection.html#map\">map</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#onChange\"><a href=\"ddpReactiveCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#one\"><a href=\"ddpReactiveCollection.html#one\">one</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#reduce\"><a href=\"ddpReactiveCollection.html#reduce\">reduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#settings\"><a href=\"ddpReactiveCollection.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#sort\"><a href=\"ddpReactiveCollection.html#sort\">sort</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#start\"><a href=\"ddpReactiveCollection.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#stop\"><a href=\"ddpReactiveCollection.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveDocument\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#data\"><a href=\"ddpReactiveDocument.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#onChange\"><a href=\"ddpReactiveDocument.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#settings\"><a href=\"ddpReactiveDocument.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#start\"><a href=\"ddpReactiveDocument.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#stop\"><a href=\"ddpReactiveDocument.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReducer\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReducer.html\">ddpReducer</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#data\"><a href=\"ddpReducer.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#doReduce\"><a href=\"ddpReducer.html#doReduce\">doReduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#onChange\"><a href=\"ddpReducer.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#start\"><a href=\"ddpReducer.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#stop\"><a href=\"ddpReducer.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpSubscription\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpSubscription.html\">ddpSubscription</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isOn\"><a href=\"ddpSubscription.html#isOn\">isOn</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isReady\"><a href=\"ddpSubscription.html#isReady\">isReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isStopped\"><a href=\"ddpSubscription.html#isStopped\">isStopped</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#nosub\"><a href=\"ddpSubscription.html#nosub\">nosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onNosub\"><a href=\"ddpSubscription.html#onNosub\">onNosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onReady\"><a href=\"ddpSubscription.html#onReady\">onReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#ready\"><a href=\"ddpSubscription.html#ready\">ready</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#remove\"><a href=\"ddpSubscription.html#remove\">remove</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#restart\"><a href=\"ddpSubscription.html#restart\">restart</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#start\"><a href=\"ddpSubscription.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#stop\"><a href=\"ddpSubscription.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"simpleDDP\">\n            <span class=\"title  \">\n                \n                <a href=\"simpleDDP.html\">simpleDDP</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            <span class=\"subtitle\">Members</span>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#collections\"><a href=\"simpleDDP.html#collections\">collections</a></li>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#connected\"><a href=\"simpleDDP.html#connected\">connected</a></li>\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#apply\"><a href=\"simpleDDP.html#apply\">apply</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#call\"><a href=\"simpleDDP.html#call\">call</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#clearData\"><a href=\"simpleDDP.html#clearData\">clearData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#collection\"><a href=\"simpleDDP.html#collection\">collection</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#connect\"><a href=\"simpleDDP.html#connect\">connect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#disconnect\"><a href=\"simpleDDP.html#disconnect\">disconnect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#exportData\"><a href=\"simpleDDP.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#importData\"><a href=\"simpleDDP.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#markAsReady\"><a href=\"simpleDDP.html#markAsReady\">markAsReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#on\"><a href=\"simpleDDP.html#on\">on</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#stopChangeListeners\"><a href=\"simpleDDP.html#stopChangeListeners\">stopChangeListeners</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#sub\"><a href=\"simpleDDP.html#sub\">sub</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#subscribe\"><a href=\"simpleDDP.html#subscribe\">subscribe</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n    </ul>\n</div>\n    <div class=\"main\">\n        <h1 class=\"page-title\" data-filename=\"ddpOnChange.html\">Class: ddpOnChange</h1>\n        \n\n\n\n<section>\n    \n<header>\n    <div class=\"header content-size\">\n        <h2>ddpOnChange\n        </h2>\n        \n            <div class=\"class-description\"><p>DDP change listener class.</p></div>\n        \n    </div>\n</header>  \n\n<article class=\"content-size\">\n    <div class=\"container-overview\">\n    \n    \n    \n        \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"ddpOnChange\">\n            <a class=\"share-icon\" href=\"#ddpOnChange\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                new ddpOnChange\n            </span>\n            <span class=\"signature\">(obj, inst, <span class=\"optional\">listenersArray</span>)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>obj</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>Describes changes of interest.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>inst</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">*</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>Event handler instance.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>listenersArray</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"simpleDDP.html\">simpleDDP</a></span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    'onChangeFuncs'\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Property name of event handler instance, array of listeners.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n    \n    </div>\n    \n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Classes</h3>\n        \n        <dl class=\"clearfix summary-list list-classes\">\n            <dt class=\"\"><a href=\"ddpOnChange.html\">ddpOnChange</a></dt>\n            \n        </dl>\n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Methods</h3>\n        \n        <dl class=\"list-methods\">\n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"start\">\n            <a class=\"share-icon\" href=\"#start\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                start\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Start change listener. This method is being called on instance creation.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"stop\">\n            <a class=\"share-icon\" href=\"#stop\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                stop\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Stops change listener.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        </dl>\n    \n    \n    \n    \n    \n\n    \n</article>\n\n</section>  \n\n\n\n\n\n        \n\n        <footer class=\"content-size\">\n            <div class=\"footer\">\n                Documentation generated by <a target=\"_blank\" href=\"https://github.com/jsdoc3/jsdoc\">JSDoc 3.6.3</a> on Wed Aug 07 2019 02:35:33 GMT+0300 (MSK)\n            </div>\n        </footer>\n    </div>\n</div>\n<script>prettyPrint();</script>\n<script src=\"scripts/main.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "docs/ddpReactiveCollection.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>SimpleDDP Docs</title>\n    \n    <meta name=\"description\" content=\"SimpleDDP Docs\" />\n    \n        <meta name=\"keywords\" content=\"ddp, simpleddp, websocket, meteor\" />\n        <meta name=\"keyword\" content=\"ddp, simpleddp, websocket, meteor\" />\n    \n    \n    \n    <meta property=\"og:title\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og:image\" content=\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\"/>\n    <meta property=\"og:site_name\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:url\" content=\"\"/>\n    \n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <script src=\"scripts/prettify/prettify.js\"></script>\n    <script src=\"scripts/prettify/lang-css.js\"></script>\n    <script src=\"scripts/jquery.min.js\"></script>\n    <!--[if lt IE 9]>\n      <script src=\"//html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n    <link href=\"https://fonts.googleapis.com/css?family=Libre+Franklin:400,700\" rel=\"stylesheet\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/prettify-tomorrow.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/bootstrap.min.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/main.css\">\n    \n    \n    <script>\n    var config = {\"monospaceLinks\":false,\"cleverLinks\":false,\"applicationName\":\"SimpleDDP\",\"disqus\":\"\",\"googleAnalytics\":\"\",\"openGraph\":{\"title\":\"SimpleDDP Docs\",\"type\":\"website\",\"image\":\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\"site_name\":\"SimpleDDP Docs\",\"url\":\"\"},\"meta\":{\"title\":\"SimpleDDP Docs\",\"description\":\"SimpleDDP Docs\",\"keyword\":\"ddp, simpleddp, websocket, meteor\"},\"linenums\":true,\"default\":{}};\n    </script>\n    \n\n    \n</head>\n<body>\n<div id=\"wrap\" class=\"clearfix\">\n    \n<div class=\"navigation\">\n    <h3 class=\"applicationName\"><a href=\"index.html\">SimpleDDP</a></h3>\n    <button id=\"menuToggle\" class=\"btn btn-link btn-lg menu-toggle\">\n        <span class=\"glyphicon glyphicon-menu-hamburger\"></span>\n    </button>\n    <div class=\"search\">\n        <input id=\"search\" type=\"text\" class=\"form-control input-md\" placeholder=\"Search...\">\n    </div>\n    <ul class=\"list\">\n    \n        <li class=\"item\" data-name=\"ddpCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpCollection.html\">ddpCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#exportData\"><a href=\"ddpCollection.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#fetch\"><a href=\"ddpCollection.html#fetch\">fetch</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#filter\"><a href=\"ddpCollection.html#filter\">filter</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#importData\"><a href=\"ddpCollection.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#onChange\"><a href=\"ddpCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#reactive\"><a href=\"ddpCollection.html#reactive\">reactive</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpEventListener\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpEventListener.html\">ddpEventListener</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#start\"><a href=\"ddpEventListener.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#stop\"><a href=\"ddpEventListener.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpOnChange\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpOnChange.html\">ddpOnChange</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#start\"><a href=\"ddpOnChange.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#stop\"><a href=\"ddpOnChange.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#_updateReactiveObjects\"><a href=\"ddpReactiveCollection.html#_updateReactiveObjects\">_updateReactiveObjects</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#count\"><a href=\"ddpReactiveCollection.html#count\">count</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#data\"><a href=\"ddpReactiveCollection.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#map\"><a href=\"ddpReactiveCollection.html#map\">map</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#onChange\"><a href=\"ddpReactiveCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#one\"><a href=\"ddpReactiveCollection.html#one\">one</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#reduce\"><a href=\"ddpReactiveCollection.html#reduce\">reduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#settings\"><a href=\"ddpReactiveCollection.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#sort\"><a href=\"ddpReactiveCollection.html#sort\">sort</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#start\"><a href=\"ddpReactiveCollection.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#stop\"><a href=\"ddpReactiveCollection.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveDocument\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#data\"><a href=\"ddpReactiveDocument.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#onChange\"><a href=\"ddpReactiveDocument.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#settings\"><a href=\"ddpReactiveDocument.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#start\"><a href=\"ddpReactiveDocument.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#stop\"><a href=\"ddpReactiveDocument.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReducer\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReducer.html\">ddpReducer</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#data\"><a href=\"ddpReducer.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#doReduce\"><a href=\"ddpReducer.html#doReduce\">doReduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#onChange\"><a href=\"ddpReducer.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#start\"><a href=\"ddpReducer.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#stop\"><a href=\"ddpReducer.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpSubscription\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpSubscription.html\">ddpSubscription</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isOn\"><a href=\"ddpSubscription.html#isOn\">isOn</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isReady\"><a href=\"ddpSubscription.html#isReady\">isReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isStopped\"><a href=\"ddpSubscription.html#isStopped\">isStopped</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#nosub\"><a href=\"ddpSubscription.html#nosub\">nosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onNosub\"><a href=\"ddpSubscription.html#onNosub\">onNosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onReady\"><a href=\"ddpSubscription.html#onReady\">onReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#ready\"><a href=\"ddpSubscription.html#ready\">ready</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#remove\"><a href=\"ddpSubscription.html#remove\">remove</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#restart\"><a href=\"ddpSubscription.html#restart\">restart</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#start\"><a href=\"ddpSubscription.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#stop\"><a href=\"ddpSubscription.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"simpleDDP\">\n            <span class=\"title  \">\n                \n                <a href=\"simpleDDP.html\">simpleDDP</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            <span class=\"subtitle\">Members</span>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#collections\"><a href=\"simpleDDP.html#collections\">collections</a></li>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#connected\"><a href=\"simpleDDP.html#connected\">connected</a></li>\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#apply\"><a href=\"simpleDDP.html#apply\">apply</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#call\"><a href=\"simpleDDP.html#call\">call</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#clearData\"><a href=\"simpleDDP.html#clearData\">clearData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#collection\"><a href=\"simpleDDP.html#collection\">collection</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#connect\"><a href=\"simpleDDP.html#connect\">connect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#disconnect\"><a href=\"simpleDDP.html#disconnect\">disconnect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#exportData\"><a href=\"simpleDDP.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#importData\"><a href=\"simpleDDP.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#markAsReady\"><a href=\"simpleDDP.html#markAsReady\">markAsReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#on\"><a href=\"simpleDDP.html#on\">on</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#stopChangeListeners\"><a href=\"simpleDDP.html#stopChangeListeners\">stopChangeListeners</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#sub\"><a href=\"simpleDDP.html#sub\">sub</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#subscribe\"><a href=\"simpleDDP.html#subscribe\">subscribe</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n    </ul>\n</div>\n    <div class=\"main\">\n        <h1 class=\"page-title\" data-filename=\"ddpReactiveCollection.html\">Class: ddpReactiveCollection</h1>\n        \n\n\n\n<section>\n    \n<header>\n    <div class=\"header content-size\">\n        <h2>ddpReactiveCollection\n        </h2>\n        \n            <div class=\"class-description\"><p>A reactive collection class.</p></div>\n        \n    </div>\n</header>  \n\n<article class=\"content-size\">\n    <div class=\"container-overview\">\n    \n    \n    \n        \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"ddpReactiveCollection\">\n            <a class=\"share-icon\" href=\"#ddpReactiveCollection\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                new ddpReactiveCollection\n            </span>\n            <span class=\"signature\">(ddpCollection, <span class=\"optional\">skiplimit</span>)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>ddpCollection</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"ddpCollection.html\">ddpCollection</a></span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>Instance of @see ddpCollection class.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>skiplimit</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    {skip:0,limit:Infinity}\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Object for declarative reactive collection slicing.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n    \n    </div>\n    \n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Classes</h3>\n        \n        <dl class=\"clearfix summary-list list-classes\">\n            <dt class=\"\"><a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a></dt>\n            \n        </dl>\n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Methods</h3>\n        \n        <dl class=\"list-methods\">\n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"_updateReactiveObjects\">\n            <a class=\"share-icon\" href=\"#_updateReactiveObjects\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                _updateReactiveObjects\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Sends new object state for every associated reactive object.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"count\">\n            <a class=\"share-icon\" href=\"#count\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                count\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Object</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Reactive length of the local collection.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Object\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Object with reactive length of the local collection. {result}</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"data\">\n            <a class=\"share-icon\" href=\"#data\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                data\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Array</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns reactive local collection with applied sorting, skip and limit.\nThis returned array is being mutated within this class instance.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Array\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Local collection with applied sorting, skip and limit.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"map\">\n            <a class=\"share-icon\" href=\"#map\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                map\n            </span>\n            <span class=\"signature\">(f)</span><span class=\"type-signature\"><a href=\"ddpReducer.html\">ddpReducer</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Maps reactive local collection to another reactive array.\nSpecified function form <a target=\"_blank\" href=\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map\">https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map</a>.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function that produces an element of the new Array.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"ddpReducer.html\">ddpReducer</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Object that allows to get reactive mapped data @see ddpReducer.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"onChange\">\n            <a class=\"share-icon\" href=\"#onChange\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                onChange\n            </span>\n            <span class=\"signature\">(f)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Runs a function every time a change occurs.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function which recieves new collection at each change.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"one\">\n            <a class=\"share-icon\" href=\"#one\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                one\n            </span>\n            <span class=\"signature\">(<span class=\"optional\">settings</span>)</span><span class=\"type-signature\"><a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns a reactive object which fields are always the same as the first object in the collection.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>settings</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    {preserve:false}\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Settings for reactive object. Use {preserve:true} if you want to keep object on remove.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Object that allows to get reactive object based on reduced reactive local collection @see ddpReactiveDocument.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"reduce\">\n            <a class=\"share-icon\" href=\"#reduce\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                reduce\n            </span>\n            <span class=\"signature\">(f, initialValue)</span><span class=\"type-signature\"><a href=\"ddpReducer.html\">ddpReducer</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Reduces reactive local collection.\nSpecified function form <a target=\"_blank\" href=\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce\">https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce</a>.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function to execute on each element in the array.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>initialValue</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">*</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Value to use as the first argument to the first call of the function.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"ddpReducer.html\">ddpReducer</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Object that allows to get reactive object based on reduced reactive local collection @see ddpReducer.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"settings\">\n            <a class=\"share-icon\" href=\"#settings\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                settings\n            </span>\n            <span class=\"signature\">(<span class=\"optional\">skiplimit</span>)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Update ddpReactiveCollection settings.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>skiplimit</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    {skip:0,limit:Infinity}\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Object for declarative reactive collection slicing.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"sort\">\n            <a class=\"share-icon\" href=\"#sort\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                sort\n            </span>\n            <span class=\"signature\">(f)</span><span class=\"type-signature\">this</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Sorts local collection according to specified function.\nSpecified function form <a target=\"_blank\" href=\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort\">https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort</a>.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>A function used for sorting.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        this\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"start\">\n            <a class=\"share-icon\" href=\"#start\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                start\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Start reactivity. This method is being called on instance creation.\nAlso starts every associated reactive object.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"stop\">\n            <a class=\"share-icon\" href=\"#stop\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                stop\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Stops reactivity. Also stops associated reactive objects.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        </dl>\n    \n    \n    \n    \n    \n\n    \n</article>\n\n</section>  \n\n\n\n\n\n        \n\n        <footer class=\"content-size\">\n            <div class=\"footer\">\n                Documentation generated by <a target=\"_blank\" href=\"https://github.com/jsdoc3/jsdoc\">JSDoc 3.6.3</a> on Wed Aug 07 2019 02:35:33 GMT+0300 (MSK)\n            </div>\n        </footer>\n    </div>\n</div>\n<script>prettyPrint();</script>\n<script src=\"scripts/main.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "docs/ddpReactiveDocument.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>SimpleDDP Docs</title>\n    \n    <meta name=\"description\" content=\"SimpleDDP Docs\" />\n    \n        <meta name=\"keywords\" content=\"ddp, simpleddp, websocket, meteor\" />\n        <meta name=\"keyword\" content=\"ddp, simpleddp, websocket, meteor\" />\n    \n    \n    \n    <meta property=\"og:title\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og:image\" content=\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\"/>\n    <meta property=\"og:site_name\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:url\" content=\"\"/>\n    \n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <script src=\"scripts/prettify/prettify.js\"></script>\n    <script src=\"scripts/prettify/lang-css.js\"></script>\n    <script src=\"scripts/jquery.min.js\"></script>\n    <!--[if lt IE 9]>\n      <script src=\"//html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n    <link href=\"https://fonts.googleapis.com/css?family=Libre+Franklin:400,700\" rel=\"stylesheet\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/prettify-tomorrow.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/bootstrap.min.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/main.css\">\n    \n    \n    <script>\n    var config = {\"monospaceLinks\":false,\"cleverLinks\":false,\"applicationName\":\"SimpleDDP\",\"disqus\":\"\",\"googleAnalytics\":\"\",\"openGraph\":{\"title\":\"SimpleDDP Docs\",\"type\":\"website\",\"image\":\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\"site_name\":\"SimpleDDP Docs\",\"url\":\"\"},\"meta\":{\"title\":\"SimpleDDP Docs\",\"description\":\"SimpleDDP Docs\",\"keyword\":\"ddp, simpleddp, websocket, meteor\"},\"linenums\":true,\"default\":{}};\n    </script>\n    \n\n    \n</head>\n<body>\n<div id=\"wrap\" class=\"clearfix\">\n    \n<div class=\"navigation\">\n    <h3 class=\"applicationName\"><a href=\"index.html\">SimpleDDP</a></h3>\n    <button id=\"menuToggle\" class=\"btn btn-link btn-lg menu-toggle\">\n        <span class=\"glyphicon glyphicon-menu-hamburger\"></span>\n    </button>\n    <div class=\"search\">\n        <input id=\"search\" type=\"text\" class=\"form-control input-md\" placeholder=\"Search...\">\n    </div>\n    <ul class=\"list\">\n    \n        <li class=\"item\" data-name=\"ddpCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpCollection.html\">ddpCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#exportData\"><a href=\"ddpCollection.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#fetch\"><a href=\"ddpCollection.html#fetch\">fetch</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#filter\"><a href=\"ddpCollection.html#filter\">filter</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#importData\"><a href=\"ddpCollection.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#onChange\"><a href=\"ddpCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#reactive\"><a href=\"ddpCollection.html#reactive\">reactive</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpEventListener\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpEventListener.html\">ddpEventListener</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#start\"><a href=\"ddpEventListener.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#stop\"><a href=\"ddpEventListener.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpOnChange\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpOnChange.html\">ddpOnChange</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#start\"><a href=\"ddpOnChange.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#stop\"><a href=\"ddpOnChange.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#_updateReactiveObjects\"><a href=\"ddpReactiveCollection.html#_updateReactiveObjects\">_updateReactiveObjects</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#count\"><a href=\"ddpReactiveCollection.html#count\">count</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#data\"><a href=\"ddpReactiveCollection.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#map\"><a href=\"ddpReactiveCollection.html#map\">map</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#onChange\"><a href=\"ddpReactiveCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#one\"><a href=\"ddpReactiveCollection.html#one\">one</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#reduce\"><a href=\"ddpReactiveCollection.html#reduce\">reduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#settings\"><a href=\"ddpReactiveCollection.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#sort\"><a href=\"ddpReactiveCollection.html#sort\">sort</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#start\"><a href=\"ddpReactiveCollection.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#stop\"><a href=\"ddpReactiveCollection.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveDocument\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#data\"><a href=\"ddpReactiveDocument.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#onChange\"><a href=\"ddpReactiveDocument.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#settings\"><a href=\"ddpReactiveDocument.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#start\"><a href=\"ddpReactiveDocument.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#stop\"><a href=\"ddpReactiveDocument.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReducer\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReducer.html\">ddpReducer</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#data\"><a href=\"ddpReducer.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#doReduce\"><a href=\"ddpReducer.html#doReduce\">doReduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#onChange\"><a href=\"ddpReducer.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#start\"><a href=\"ddpReducer.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#stop\"><a href=\"ddpReducer.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpSubscription\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpSubscription.html\">ddpSubscription</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isOn\"><a href=\"ddpSubscription.html#isOn\">isOn</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isReady\"><a href=\"ddpSubscription.html#isReady\">isReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isStopped\"><a href=\"ddpSubscription.html#isStopped\">isStopped</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#nosub\"><a href=\"ddpSubscription.html#nosub\">nosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onNosub\"><a href=\"ddpSubscription.html#onNosub\">onNosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onReady\"><a href=\"ddpSubscription.html#onReady\">onReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#ready\"><a href=\"ddpSubscription.html#ready\">ready</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#remove\"><a href=\"ddpSubscription.html#remove\">remove</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#restart\"><a href=\"ddpSubscription.html#restart\">restart</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#start\"><a href=\"ddpSubscription.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#stop\"><a href=\"ddpSubscription.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"simpleDDP\">\n            <span class=\"title  \">\n                \n                <a href=\"simpleDDP.html\">simpleDDP</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            <span class=\"subtitle\">Members</span>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#collections\"><a href=\"simpleDDP.html#collections\">collections</a></li>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#connected\"><a href=\"simpleDDP.html#connected\">connected</a></li>\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#apply\"><a href=\"simpleDDP.html#apply\">apply</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#call\"><a href=\"simpleDDP.html#call\">call</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#clearData\"><a href=\"simpleDDP.html#clearData\">clearData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#collection\"><a href=\"simpleDDP.html#collection\">collection</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#connect\"><a href=\"simpleDDP.html#connect\">connect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#disconnect\"><a href=\"simpleDDP.html#disconnect\">disconnect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#exportData\"><a href=\"simpleDDP.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#importData\"><a href=\"simpleDDP.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#markAsReady\"><a href=\"simpleDDP.html#markAsReady\">markAsReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#on\"><a href=\"simpleDDP.html#on\">on</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#stopChangeListeners\"><a href=\"simpleDDP.html#stopChangeListeners\">stopChangeListeners</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#sub\"><a href=\"simpleDDP.html#sub\">sub</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#subscribe\"><a href=\"simpleDDP.html#subscribe\">subscribe</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n    </ul>\n</div>\n    <div class=\"main\">\n        <h1 class=\"page-title\" data-filename=\"ddpReactiveDocument.html\">Class: ddpReactiveDocument</h1>\n        \n\n\n\n<section>\n    \n<header>\n    <div class=\"header content-size\">\n        <h2>ddpReactiveDocument\n        </h2>\n        \n            <div class=\"class-description\"><p>A reactive document class.</p></div>\n        \n    </div>\n</header>  \n\n<article class=\"content-size\">\n    <div class=\"container-overview\">\n    \n    \n    \n        \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"ddpReactiveDocument\">\n            <a class=\"share-icon\" href=\"#ddpReactiveDocument\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                new ddpReactiveDocument\n            </span>\n            <span class=\"signature\">(ddpReactiveCollectionInstance, <span class=\"optional\">settings</span>)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>ddpReactiveCollectionInstance</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a></span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>Instance of @see ddpReactiveCollection class.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>settings</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    {preserve:false}\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Settings for reactive object. When preserve is true,\nreactive object won't change when corresponding object is being deleted.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n    \n    </div>\n    \n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Classes</h3>\n        \n        <dl class=\"clearfix summary-list list-classes\">\n            <dt class=\"\"><a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a></dt>\n            \n        </dl>\n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Methods</h3>\n        \n        <dl class=\"list-methods\">\n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"data\">\n            <a class=\"share-icon\" href=\"#data\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                data\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Object</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns reactive document.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Object\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"onChange\">\n            <a class=\"share-icon\" href=\"#onChange\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                onChange\n            </span>\n            <span class=\"signature\">(f)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Runs a function every time a change occurs.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function which recieves a new value at each change.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"settings\">\n            <a class=\"share-icon\" href=\"#settings\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                settings\n            </span>\n            <span class=\"signature\">(settings)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Change reactivity settings.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>settings</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                \n                \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>preserve</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">boolean</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>When preserve is true,reactive object won't change when corresponding object is being deleted.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n            </td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"start\">\n            <a class=\"share-icon\" href=\"#start\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                start\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Starts reactiveness for the document. This method is being called on instance creation.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"stop\">\n            <a class=\"share-icon\" href=\"#stop\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                stop\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Stops reactiveness for the document.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        </dl>\n    \n    \n    \n    \n    \n\n    \n</article>\n\n</section>  \n\n\n\n\n\n        \n\n        <footer class=\"content-size\">\n            <div class=\"footer\">\n                Documentation generated by <a target=\"_blank\" href=\"https://github.com/jsdoc3/jsdoc\">JSDoc 3.6.3</a> on Wed Aug 07 2019 02:35:33 GMT+0300 (MSK)\n            </div>\n        </footer>\n    </div>\n</div>\n<script>prettyPrint();</script>\n<script src=\"scripts/main.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "docs/ddpReducer.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>SimpleDDP Docs</title>\n    \n    <meta name=\"description\" content=\"SimpleDDP Docs\" />\n    \n        <meta name=\"keywords\" content=\"ddp, simpleddp, websocket, meteor\" />\n        <meta name=\"keyword\" content=\"ddp, simpleddp, websocket, meteor\" />\n    \n    \n    \n    <meta property=\"og:title\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og:image\" content=\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\"/>\n    <meta property=\"og:site_name\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:url\" content=\"\"/>\n    \n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <script src=\"scripts/prettify/prettify.js\"></script>\n    <script src=\"scripts/prettify/lang-css.js\"></script>\n    <script src=\"scripts/jquery.min.js\"></script>\n    <!--[if lt IE 9]>\n      <script src=\"//html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n    <link href=\"https://fonts.googleapis.com/css?family=Libre+Franklin:400,700\" rel=\"stylesheet\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/prettify-tomorrow.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/bootstrap.min.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/main.css\">\n    \n    \n    <script>\n    var config = {\"monospaceLinks\":false,\"cleverLinks\":false,\"applicationName\":\"SimpleDDP\",\"disqus\":\"\",\"googleAnalytics\":\"\",\"openGraph\":{\"title\":\"SimpleDDP Docs\",\"type\":\"website\",\"image\":\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\"site_name\":\"SimpleDDP Docs\",\"url\":\"\"},\"meta\":{\"title\":\"SimpleDDP Docs\",\"description\":\"SimpleDDP Docs\",\"keyword\":\"ddp, simpleddp, websocket, meteor\"},\"linenums\":true,\"default\":{}};\n    </script>\n    \n\n    \n</head>\n<body>\n<div id=\"wrap\" class=\"clearfix\">\n    \n<div class=\"navigation\">\n    <h3 class=\"applicationName\"><a href=\"index.html\">SimpleDDP</a></h3>\n    <button id=\"menuToggle\" class=\"btn btn-link btn-lg menu-toggle\">\n        <span class=\"glyphicon glyphicon-menu-hamburger\"></span>\n    </button>\n    <div class=\"search\">\n        <input id=\"search\" type=\"text\" class=\"form-control input-md\" placeholder=\"Search...\">\n    </div>\n    <ul class=\"list\">\n    \n        <li class=\"item\" data-name=\"ddpCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpCollection.html\">ddpCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#exportData\"><a href=\"ddpCollection.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#fetch\"><a href=\"ddpCollection.html#fetch\">fetch</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#filter\"><a href=\"ddpCollection.html#filter\">filter</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#importData\"><a href=\"ddpCollection.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#onChange\"><a href=\"ddpCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#reactive\"><a href=\"ddpCollection.html#reactive\">reactive</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpEventListener\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpEventListener.html\">ddpEventListener</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#start\"><a href=\"ddpEventListener.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#stop\"><a href=\"ddpEventListener.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpOnChange\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpOnChange.html\">ddpOnChange</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#start\"><a href=\"ddpOnChange.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#stop\"><a href=\"ddpOnChange.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#_updateReactiveObjects\"><a href=\"ddpReactiveCollection.html#_updateReactiveObjects\">_updateReactiveObjects</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#count\"><a href=\"ddpReactiveCollection.html#count\">count</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#data\"><a href=\"ddpReactiveCollection.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#map\"><a href=\"ddpReactiveCollection.html#map\">map</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#onChange\"><a href=\"ddpReactiveCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#one\"><a href=\"ddpReactiveCollection.html#one\">one</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#reduce\"><a href=\"ddpReactiveCollection.html#reduce\">reduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#settings\"><a href=\"ddpReactiveCollection.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#sort\"><a href=\"ddpReactiveCollection.html#sort\">sort</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#start\"><a href=\"ddpReactiveCollection.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#stop\"><a href=\"ddpReactiveCollection.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveDocument\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#data\"><a href=\"ddpReactiveDocument.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#onChange\"><a href=\"ddpReactiveDocument.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#settings\"><a href=\"ddpReactiveDocument.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#start\"><a href=\"ddpReactiveDocument.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#stop\"><a href=\"ddpReactiveDocument.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReducer\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReducer.html\">ddpReducer</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#data\"><a href=\"ddpReducer.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#doReduce\"><a href=\"ddpReducer.html#doReduce\">doReduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#onChange\"><a href=\"ddpReducer.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#start\"><a href=\"ddpReducer.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#stop\"><a href=\"ddpReducer.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpSubscription\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpSubscription.html\">ddpSubscription</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isOn\"><a href=\"ddpSubscription.html#isOn\">isOn</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isReady\"><a href=\"ddpSubscription.html#isReady\">isReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isStopped\"><a href=\"ddpSubscription.html#isStopped\">isStopped</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#nosub\"><a href=\"ddpSubscription.html#nosub\">nosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onNosub\"><a href=\"ddpSubscription.html#onNosub\">onNosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onReady\"><a href=\"ddpSubscription.html#onReady\">onReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#ready\"><a href=\"ddpSubscription.html#ready\">ready</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#remove\"><a href=\"ddpSubscription.html#remove\">remove</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#restart\"><a href=\"ddpSubscription.html#restart\">restart</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#start\"><a href=\"ddpSubscription.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#stop\"><a href=\"ddpSubscription.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"simpleDDP\">\n            <span class=\"title  \">\n                \n                <a href=\"simpleDDP.html\">simpleDDP</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            <span class=\"subtitle\">Members</span>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#collections\"><a href=\"simpleDDP.html#collections\">collections</a></li>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#connected\"><a href=\"simpleDDP.html#connected\">connected</a></li>\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#apply\"><a href=\"simpleDDP.html#apply\">apply</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#call\"><a href=\"simpleDDP.html#call\">call</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#clearData\"><a href=\"simpleDDP.html#clearData\">clearData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#collection\"><a href=\"simpleDDP.html#collection\">collection</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#connect\"><a href=\"simpleDDP.html#connect\">connect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#disconnect\"><a href=\"simpleDDP.html#disconnect\">disconnect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#exportData\"><a href=\"simpleDDP.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#importData\"><a href=\"simpleDDP.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#markAsReady\"><a href=\"simpleDDP.html#markAsReady\">markAsReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#on\"><a href=\"simpleDDP.html#on\">on</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#stopChangeListeners\"><a href=\"simpleDDP.html#stopChangeListeners\">stopChangeListeners</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#sub\"><a href=\"simpleDDP.html#sub\">sub</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#subscribe\"><a href=\"simpleDDP.html#subscribe\">subscribe</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n    </ul>\n</div>\n    <div class=\"main\">\n        <h1 class=\"page-title\" data-filename=\"ddpReducer.html\">Class: ddpReducer</h1>\n        \n\n\n\n<section>\n    \n<header>\n    <div class=\"header content-size\">\n        <h2>ddpReducer\n        </h2>\n        \n            <div class=\"class-description\"><p>A reducer class for a reactive document.</p></div>\n        \n    </div>\n</header>  \n\n<article class=\"content-size\">\n    <div class=\"container-overview\">\n    \n    \n    \n        \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"ddpReducer\">\n            <a class=\"share-icon\" href=\"#ddpReducer\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                new ddpReducer\n            </span>\n            <span class=\"signature\">(ddpReactiveCollectionInstance, reducer, initialValue)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>ddpReactiveCollectionInstance</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a></span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Instance of @see ddpReactiveCollection class.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>reducer</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function for a reduction.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>initialValue</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">*</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Initial value for a reduction function.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n    \n    </div>\n    \n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Classes</h3>\n        \n        <dl class=\"clearfix summary-list list-classes\">\n            <dt class=\"\"><a href=\"ddpReducer.html\">ddpReducer</a></dt>\n            \n        </dl>\n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Methods</h3>\n        \n        <dl class=\"list-methods\">\n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"data\">\n            <a class=\"share-icon\" href=\"#data\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                data\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Object</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns reactive reduce.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Object\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>{result:reducedValue}</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"doReduce\">\n            <a class=\"share-icon\" href=\"#doReduce\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                doReduce\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Forcibly reduces reactive data.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"onChange\">\n            <a class=\"share-icon\" href=\"#onChange\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                onChange\n            </span>\n            <span class=\"signature\">(f)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Runs a function every time a change occurs.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function which recieves a reduced value at each change.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"start\">\n            <a class=\"share-icon\" href=\"#start\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                start\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Starts reactiveness for the reduced value of the collection.\nThis method is being called on instance creation.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"stop\">\n            <a class=\"share-icon\" href=\"#stop\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                stop\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Stops reactiveness.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        </dl>\n    \n    \n    \n    \n    \n\n    \n</article>\n\n</section>  \n\n\n\n\n\n        \n\n        <footer class=\"content-size\">\n            <div class=\"footer\">\n                Documentation generated by <a target=\"_blank\" href=\"https://github.com/jsdoc3/jsdoc\">JSDoc 3.6.3</a> on Wed Aug 07 2019 02:35:33 GMT+0300 (MSK)\n            </div>\n        </footer>\n    </div>\n</div>\n<script>prettyPrint();</script>\n<script src=\"scripts/main.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "docs/ddpSubscription.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>SimpleDDP Docs</title>\n    \n    <meta name=\"description\" content=\"SimpleDDP Docs\" />\n    \n        <meta name=\"keywords\" content=\"ddp, simpleddp, websocket, meteor\" />\n        <meta name=\"keyword\" content=\"ddp, simpleddp, websocket, meteor\" />\n    \n    \n    \n    <meta property=\"og:title\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og:image\" content=\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\"/>\n    <meta property=\"og:site_name\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:url\" content=\"\"/>\n    \n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <script src=\"scripts/prettify/prettify.js\"></script>\n    <script src=\"scripts/prettify/lang-css.js\"></script>\n    <script src=\"scripts/jquery.min.js\"></script>\n    <!--[if lt IE 9]>\n      <script src=\"//html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n    <link href=\"https://fonts.googleapis.com/css?family=Libre+Franklin:400,700\" rel=\"stylesheet\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/prettify-tomorrow.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/bootstrap.min.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/main.css\">\n    \n    \n    <script>\n    var config = {\"monospaceLinks\":false,\"cleverLinks\":false,\"applicationName\":\"SimpleDDP\",\"disqus\":\"\",\"googleAnalytics\":\"\",\"openGraph\":{\"title\":\"SimpleDDP Docs\",\"type\":\"website\",\"image\":\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\"site_name\":\"SimpleDDP Docs\",\"url\":\"\"},\"meta\":{\"title\":\"SimpleDDP Docs\",\"description\":\"SimpleDDP Docs\",\"keyword\":\"ddp, simpleddp, websocket, meteor\"},\"linenums\":true,\"default\":{}};\n    </script>\n    \n\n    \n</head>\n<body>\n<div id=\"wrap\" class=\"clearfix\">\n    \n<div class=\"navigation\">\n    <h3 class=\"applicationName\"><a href=\"index.html\">SimpleDDP</a></h3>\n    <button id=\"menuToggle\" class=\"btn btn-link btn-lg menu-toggle\">\n        <span class=\"glyphicon glyphicon-menu-hamburger\"></span>\n    </button>\n    <div class=\"search\">\n        <input id=\"search\" type=\"text\" class=\"form-control input-md\" placeholder=\"Search...\">\n    </div>\n    <ul class=\"list\">\n    \n        <li class=\"item\" data-name=\"ddpCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpCollection.html\">ddpCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#exportData\"><a href=\"ddpCollection.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#fetch\"><a href=\"ddpCollection.html#fetch\">fetch</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#filter\"><a href=\"ddpCollection.html#filter\">filter</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#importData\"><a href=\"ddpCollection.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#onChange\"><a href=\"ddpCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#reactive\"><a href=\"ddpCollection.html#reactive\">reactive</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpEventListener\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpEventListener.html\">ddpEventListener</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#start\"><a href=\"ddpEventListener.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#stop\"><a href=\"ddpEventListener.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpOnChange\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpOnChange.html\">ddpOnChange</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#start\"><a href=\"ddpOnChange.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#stop\"><a href=\"ddpOnChange.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#_updateReactiveObjects\"><a href=\"ddpReactiveCollection.html#_updateReactiveObjects\">_updateReactiveObjects</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#count\"><a href=\"ddpReactiveCollection.html#count\">count</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#data\"><a href=\"ddpReactiveCollection.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#map\"><a href=\"ddpReactiveCollection.html#map\">map</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#onChange\"><a href=\"ddpReactiveCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#one\"><a href=\"ddpReactiveCollection.html#one\">one</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#reduce\"><a href=\"ddpReactiveCollection.html#reduce\">reduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#settings\"><a href=\"ddpReactiveCollection.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#sort\"><a href=\"ddpReactiveCollection.html#sort\">sort</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#start\"><a href=\"ddpReactiveCollection.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#stop\"><a href=\"ddpReactiveCollection.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveDocument\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#data\"><a href=\"ddpReactiveDocument.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#onChange\"><a href=\"ddpReactiveDocument.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#settings\"><a href=\"ddpReactiveDocument.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#start\"><a href=\"ddpReactiveDocument.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#stop\"><a href=\"ddpReactiveDocument.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReducer\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReducer.html\">ddpReducer</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#data\"><a href=\"ddpReducer.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#doReduce\"><a href=\"ddpReducer.html#doReduce\">doReduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#onChange\"><a href=\"ddpReducer.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#start\"><a href=\"ddpReducer.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#stop\"><a href=\"ddpReducer.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpSubscription\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpSubscription.html\">ddpSubscription</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isOn\"><a href=\"ddpSubscription.html#isOn\">isOn</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isReady\"><a href=\"ddpSubscription.html#isReady\">isReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isStopped\"><a href=\"ddpSubscription.html#isStopped\">isStopped</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#nosub\"><a href=\"ddpSubscription.html#nosub\">nosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onNosub\"><a href=\"ddpSubscription.html#onNosub\">onNosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onReady\"><a href=\"ddpSubscription.html#onReady\">onReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#ready\"><a href=\"ddpSubscription.html#ready\">ready</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#remove\"><a href=\"ddpSubscription.html#remove\">remove</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#restart\"><a href=\"ddpSubscription.html#restart\">restart</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#start\"><a href=\"ddpSubscription.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#stop\"><a href=\"ddpSubscription.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"simpleDDP\">\n            <span class=\"title  \">\n                \n                <a href=\"simpleDDP.html\">simpleDDP</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            <span class=\"subtitle\">Members</span>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#collections\"><a href=\"simpleDDP.html#collections\">collections</a></li>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#connected\"><a href=\"simpleDDP.html#connected\">connected</a></li>\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#apply\"><a href=\"simpleDDP.html#apply\">apply</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#call\"><a href=\"simpleDDP.html#call\">call</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#clearData\"><a href=\"simpleDDP.html#clearData\">clearData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#collection\"><a href=\"simpleDDP.html#collection\">collection</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#connect\"><a href=\"simpleDDP.html#connect\">connect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#disconnect\"><a href=\"simpleDDP.html#disconnect\">disconnect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#exportData\"><a href=\"simpleDDP.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#importData\"><a href=\"simpleDDP.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#markAsReady\"><a href=\"simpleDDP.html#markAsReady\">markAsReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#on\"><a href=\"simpleDDP.html#on\">on</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#stopChangeListeners\"><a href=\"simpleDDP.html#stopChangeListeners\">stopChangeListeners</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#sub\"><a href=\"simpleDDP.html#sub\">sub</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#subscribe\"><a href=\"simpleDDP.html#subscribe\">subscribe</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n    </ul>\n</div>\n    <div class=\"main\">\n        <h1 class=\"page-title\" data-filename=\"ddpSubscription.html\">Class: ddpSubscription</h1>\n        \n\n\n\n<section>\n    \n<header>\n    <div class=\"header content-size\">\n        <h2>ddpSubscription\n        </h2>\n        \n            <div class=\"class-description\"><p>DDP subscription class.</p></div>\n        \n    </div>\n</header>  \n\n<article class=\"content-size\">\n    <div class=\"container-overview\">\n    \n    \n    \n        \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"ddpSubscription\">\n            <a class=\"share-icon\" href=\"#ddpSubscription\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                new ddpSubscription\n            </span>\n            <span class=\"signature\">(pubname, args, ddplink)</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>pubname</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">String</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Publication name.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>args</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Array</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Subscription arguments.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>ddplink</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"simpleDDP.html\">simpleDDP</a></span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>simpleDDP instance.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n    \n    </div>\n    \n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Classes</h3>\n        \n        <dl class=\"clearfix summary-list list-classes\">\n            <dt class=\"\"><a href=\"ddpSubscription.html\">ddpSubscription</a></dt>\n            \n        </dl>\n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Methods</h3>\n        \n        <dl class=\"list-methods\">\n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"isOn\">\n            <a class=\"share-icon\" href=\"#isOn\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                isOn\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns true if subscription is active otherwise false.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"isReady\">\n            <a class=\"share-icon\" href=\"#isReady\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                isReady\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">boolean</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns true if subsciprtion is ready otherwise false.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        boolean\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"isStopped\">\n            <a class=\"share-icon\" href=\"#isStopped\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                isStopped\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">boolean</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns true if subscription is stopped otherwise false.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        boolean\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"nosub\">\n            <a class=\"share-icon\" href=\"#nosub\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                nosub\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns a promise which resolves when corresponding <code>nosub</code> message arrives.\nRejects when <code>nosub</code> comes with error.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"onNosub\">\n            <a class=\"share-icon\" href=\"#onNosub\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                onNosub\n            </span>\n            <span class=\"signature\">(f)</span><span class=\"type-signature\"><a href=\"ddpEventListener.html\">ddpEventListener</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Runs everytime when <code>nosub</code> message corresponding to the subscription comes from the server.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function, event handler.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"ddpEventListener.html\">ddpEventListener</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"onReady\">\n            <a class=\"share-icon\" href=\"#onReady\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                onReady\n            </span>\n            <span class=\"signature\">(f)</span><span class=\"type-signature\"><a href=\"ddpEventListener.html\">ddpEventListener</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Runs everytime when <code>ready</code> message corresponding to the subscription comes from the server.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function, event handler.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"ddpEventListener.html\">ddpEventListener</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"ready\">\n            <a class=\"share-icon\" href=\"#ready\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                ready\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Returns a promise which resolves when subscription is ready or rejects when <code>nosub</code> message arrives.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"remove\">\n            <a class=\"share-icon\" href=\"#remove\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                remove\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Completly removes subscription.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"restart\">\n            <a class=\"share-icon\" href=\"#restart\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                restart\n            </span>\n            <span class=\"signature\">(<span class=\"optional\">args</span>)</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Restart the subscription. You can also change subscription arguments.\nReturns a promise which resolves when subscription is ready.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>args</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Array</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Subscription arguments.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"start\">\n            <a class=\"share-icon\" href=\"#start\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                start\n            </span>\n            <span class=\"signature\">(args)</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Start the subscription. Runs on class creation.\nReturns a promise which resolves when subscription is ready.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>args</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Array</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Subscription arguments.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"stop\">\n            <a class=\"share-icon\" href=\"#stop\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                stop\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Stops subscription and return a promise which resolves when subscription is stopped.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        </dl>\n    \n    \n    \n    \n    \n\n    \n</article>\n\n</section>  \n\n\n\n\n\n        \n\n        <footer class=\"content-size\">\n            <div class=\"footer\">\n                Documentation generated by <a target=\"_blank\" href=\"https://github.com/jsdoc3/jsdoc\">JSDoc 3.6.3</a> on Wed Aug 07 2019 02:35:33 GMT+0300 (MSK)\n            </div>\n        </footer>\n    </div>\n</div>\n<script>prettyPrint();</script>\n<script src=\"scripts/main.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "docs/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>SimpleDDP Docs</title>\n    \n    <meta name=\"description\" content=\"SimpleDDP Docs\" />\n    \n        <meta name=\"keywords\" content=\"ddp, simpleddp, websocket, meteor\" />\n        <meta name=\"keyword\" content=\"ddp, simpleddp, websocket, meteor\" />\n    \n    \n    \n    <meta property=\"og:title\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og:image\" content=\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\"/>\n    <meta property=\"og:site_name\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:url\" content=\"\"/>\n    \n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <script src=\"scripts/prettify/prettify.js\"></script>\n    <script src=\"scripts/prettify/lang-css.js\"></script>\n    <script src=\"scripts/jquery.min.js\"></script>\n    <!--[if lt IE 9]>\n      <script src=\"//html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n    <link href=\"https://fonts.googleapis.com/css?family=Libre+Franklin:400,700\" rel=\"stylesheet\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/prettify-tomorrow.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/bootstrap.min.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/main.css\">\n    \n    \n    <script>\n    var config = {\"monospaceLinks\":false,\"cleverLinks\":false,\"applicationName\":\"SimpleDDP\",\"disqus\":\"\",\"googleAnalytics\":\"\",\"openGraph\":{\"title\":\"SimpleDDP Docs\",\"type\":\"website\",\"image\":\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\"site_name\":\"SimpleDDP Docs\",\"url\":\"\"},\"meta\":{\"title\":\"SimpleDDP Docs\",\"description\":\"SimpleDDP Docs\",\"keyword\":\"ddp, simpleddp, websocket, meteor\"},\"linenums\":true,\"default\":{}};\n    </script>\n    \n\n    \n</head>\n<body>\n<div id=\"wrap\" class=\"clearfix\">\n    \n<div class=\"navigation\">\n    <h3 class=\"applicationName\"><a href=\"index.html\">SimpleDDP</a></h3>\n    <button id=\"menuToggle\" class=\"btn btn-link btn-lg menu-toggle\">\n        <span class=\"glyphicon glyphicon-menu-hamburger\"></span>\n    </button>\n    <div class=\"search\">\n        <input id=\"search\" type=\"text\" class=\"form-control input-md\" placeholder=\"Search...\">\n    </div>\n    <ul class=\"list\">\n    \n        <li class=\"item\" data-name=\"ddpCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpCollection.html\">ddpCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#exportData\"><a href=\"ddpCollection.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#fetch\"><a href=\"ddpCollection.html#fetch\">fetch</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#filter\"><a href=\"ddpCollection.html#filter\">filter</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#importData\"><a href=\"ddpCollection.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#onChange\"><a href=\"ddpCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#reactive\"><a href=\"ddpCollection.html#reactive\">reactive</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpEventListener\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpEventListener.html\">ddpEventListener</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#start\"><a href=\"ddpEventListener.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#stop\"><a href=\"ddpEventListener.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpOnChange\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpOnChange.html\">ddpOnChange</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#start\"><a href=\"ddpOnChange.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#stop\"><a href=\"ddpOnChange.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#_updateReactiveObjects\"><a href=\"ddpReactiveCollection.html#_updateReactiveObjects\">_updateReactiveObjects</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#count\"><a href=\"ddpReactiveCollection.html#count\">count</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#data\"><a href=\"ddpReactiveCollection.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#map\"><a href=\"ddpReactiveCollection.html#map\">map</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#onChange\"><a href=\"ddpReactiveCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#one\"><a href=\"ddpReactiveCollection.html#one\">one</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#reduce\"><a href=\"ddpReactiveCollection.html#reduce\">reduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#settings\"><a href=\"ddpReactiveCollection.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#sort\"><a href=\"ddpReactiveCollection.html#sort\">sort</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#start\"><a href=\"ddpReactiveCollection.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#stop\"><a href=\"ddpReactiveCollection.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveDocument\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#data\"><a href=\"ddpReactiveDocument.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#onChange\"><a href=\"ddpReactiveDocument.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#settings\"><a href=\"ddpReactiveDocument.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#start\"><a href=\"ddpReactiveDocument.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#stop\"><a href=\"ddpReactiveDocument.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReducer\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReducer.html\">ddpReducer</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#data\"><a href=\"ddpReducer.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#doReduce\"><a href=\"ddpReducer.html#doReduce\">doReduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#onChange\"><a href=\"ddpReducer.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#start\"><a href=\"ddpReducer.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#stop\"><a href=\"ddpReducer.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpSubscription\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpSubscription.html\">ddpSubscription</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isOn\"><a href=\"ddpSubscription.html#isOn\">isOn</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isReady\"><a href=\"ddpSubscription.html#isReady\">isReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isStopped\"><a href=\"ddpSubscription.html#isStopped\">isStopped</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#nosub\"><a href=\"ddpSubscription.html#nosub\">nosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onNosub\"><a href=\"ddpSubscription.html#onNosub\">onNosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onReady\"><a href=\"ddpSubscription.html#onReady\">onReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#ready\"><a href=\"ddpSubscription.html#ready\">ready</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#remove\"><a href=\"ddpSubscription.html#remove\">remove</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#restart\"><a href=\"ddpSubscription.html#restart\">restart</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#start\"><a href=\"ddpSubscription.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#stop\"><a href=\"ddpSubscription.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"simpleDDP\">\n            <span class=\"title  \">\n                \n                <a href=\"simpleDDP.html\">simpleDDP</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            <span class=\"subtitle\">Members</span>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#collections\"><a href=\"simpleDDP.html#collections\">collections</a></li>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#connected\"><a href=\"simpleDDP.html#connected\">connected</a></li>\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#apply\"><a href=\"simpleDDP.html#apply\">apply</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#call\"><a href=\"simpleDDP.html#call\">call</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#clearData\"><a href=\"simpleDDP.html#clearData\">clearData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#collection\"><a href=\"simpleDDP.html#collection\">collection</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#connect\"><a href=\"simpleDDP.html#connect\">connect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#disconnect\"><a href=\"simpleDDP.html#disconnect\">disconnect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#exportData\"><a href=\"simpleDDP.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#importData\"><a href=\"simpleDDP.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#markAsReady\"><a href=\"simpleDDP.html#markAsReady\">markAsReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#on\"><a href=\"simpleDDP.html#on\">on</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#stopChangeListeners\"><a href=\"simpleDDP.html#stopChangeListeners\">stopChangeListeners</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#sub\"><a href=\"simpleDDP.html#sub\">sub</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#subscribe\"><a href=\"simpleDDP.html#subscribe\">subscribe</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n    </ul>\n</div>\n    <div class=\"main\">\n        <h1 class=\"page-title\" data-filename=\"index.html\">Index</h1>\n        \n\n\n    \n\n\n    <h3> </h3>\n\n\n\n\n\n\n\n\n    \n\n\n\n\n    <section>\n        <article class=\"readme content-size\"><p><a target=\"_blank\" href=\"https://badge.fury.io/js/simpleddp\"><img src=\"https://badge.fury.io/js/simpleddp.svg\" alt=\"npm version\"></a>\n<a target=\"_blank\" href=\"https://travis-ci.org/Gregivy/simpleddp\"><img src=\"https://travis-ci.org/Gregivy/simpleddp.svg?branch=master\" alt=\"Build Status\"></a>\n<a target=\"_blank\" href=\"https://david-dm.org/gregivy/simpleddp\"><img src=\"https://david-dm.org/gregivy/simpleddp.svg\" alt=\"Dependency Status\"></a>\n<a target=\"_blank\" href=\"https://david-dm.org/gregivy/simpleddp#info=devDependencies\"><img src=\"https://david-dm.org/gregivy/simpleddp/dev-status.svg\" alt=\"devDependency Status\"></a></p>\n<p align=\"center\">\n  <img width=\"300\" height=\"300\" src=\"https://github.com/Gregivy/simpleddp/raw/master/simpleddp.png\">\n</p>\n<h1>SimpleDDP 🥚</h1>\n<p>The aim of this library is to simplify the process of working with Meteor.js server over DDP protocol using external JS environments (like Node.js, Cordova, Ionic, ReactNative, etc).</p>\n<p>It is battle tested 🏰 in production and ready to use 🔨.</p>\n<p>If you like this project ⭐ is always welcome.</p>\n<p><strong>Important</strong></p>\n<p>SimpleDDP is written in ES6 and uses modern features like <em>promises</em>. Though its precompiled with Babel, your js environment must support ES6 features. So if you are planning to use SimpleDDP be sure that your js environment supports ES6 features or include polyfills yourself (like Babel Polyfill).</p>\n<p>Project uses <a target=\"_blank\" href=\"https://semver.org/spec/v2.0.0.html\">semantic versioning 2.0.0</a>.</p>\n<p>DDP (protocol) <a target=\"_blank\" href=\"https://github.com/meteor/meteor/blob/devel/packages/ddp/DDP.md\">specification</a>.</p>\n<h2><a target=\"_blank\" href=\"https://github.com/Gregivy/simpleddp/blob/master/CHANGELOG.md\">CHANGE LOG</a></h2>\n<h2>Install</h2>\n<p><code>npm install simpleddp --save</code></p>\n<h2><a target=\"_blank\" href=\"https://gregivy.github.io/simpleddp/simpleDDP.html\">Documentation</a></h2>\n<h2>Plugins</h2>\n<ul>\n<li><a target=\"_blank\" href=\"https://github.com/Gregivy/simpleddp-plugin-login\">simpleddp-plugin-login</a></li>\n</ul>\n<h2><a target=\"_blank\" href=\"https://github.com/Gregivy/simpleddp/blob/master/custom_ejson.md\">Adding custom EJSON types</a> ⭐</h2>\n<h2>Example</h2>\n<p>First of all you need WebSocket implementation for your node app.\nWe will use <a target=\"_blank\" href=\"https://www.npmjs.com/package/isomorphic-ws\">isomorphic-ws</a> package for this\nsince it works on the client and serverside.</p>\n<p><code>npm install isomorphic-ws ws --save</code></p>\n<p>Import/require <code>simpleDDP</code>.</p>\n<pre class=\"prettyprint source lang-javascript\"><code>const simpleDDP = require(&quot;simpleddp&quot;); // nodejs\nconst ws = require(&quot;isomorphic-ws&quot;);\n</code></pre>\n<p>or</p>\n<pre class=\"prettyprint source lang-javascript\"><code>import simpleDDP from 'simpleDDP'; // ES6\nimport ws from 'isomorphic-ws';\n</code></pre>\n<p>Now you should make a new simpleDDP instance.</p>\n<pre class=\"prettyprint source lang-javascript\"><code>let opts = {\n    endpoint: &quot;ws://someserver.com/websocket&quot;,\n    SocketConstructor: ws,\n    reconnectInterval: 5000\n};\nconst server = new simpleDDP(opts);\n</code></pre>\n<p>Connection is not going to be established immediately after you create a simpleDDP instance. If you need to check your connection simply use <code>server.connected</code> property which is <code>true</code> if you are connected to the server, otherwise it's <code>false</code>.</p>\n<p>You can also add some events for connection status.</p>\n<pre class=\"prettyprint source lang-javascript\"><code>server.on('connected', () => {\n    // do something\n});\n\nserver.on('disconnected', () => {\n    // for example show alert to user\n});\n\nserver.on('error', (e) => {\n    // global errors from server\n});\n</code></pre>\n<p>As an alternative you can use a <em>async/await</em> style (or <code>then(...)</code>).</p>\n<pre class=\"prettyprint source lang-javascript\"><code>(async ()=>{\n  await server.connect();\n  // connection is ready here\n})();\n</code></pre>\n<p>The next thing we are going to do is subscribing to some publications.</p>\n<pre class=\"prettyprint source lang-javascript\"><code>let userSub = server.subscribe(&quot;user_pub&quot;);\nlet otherSub = server.subscribe(&quot;other_pub&quot;,'param1',2); // you can specify arguments for subscription\n\n(async ()=>{\n  await userSub.ready();\n  let nextSub = server.subscribe(&quot;next_pub&quot;); // subscribing after userSub is ready\n  await nextSub.ready();\n  //all subs are ready here\n})();\n</code></pre>\n<p>You can fetch all things you've subscribed for using <a target=\"_blank\" href=\"https://gregivy.github.io/simpleddp/simpleDDP.html#collection\">server.collection</a> method.\nAlso you can get reactive data sources (plain js objects which will be automatically updated if something changes on the server).</p>\n<pre class=\"prettyprint source lang-javascript\"><code>(async ()=>{\n\n  // call some method\n  await server.call('somemethod');\n\n  let userSub = server.subscribe(&quot;user&quot;,userId);\n  await userSub.ready();\n\n  // get non-reactive user object\n  let user = server.collection('users').filter(user=>user.id==userId).fetch()[0];\n\n  // get reactive user object\n  let userReactiveCursor = server.collection('users').filter(user=>user.id==userId).reactive().one();\n  let userReactiveObject = userReactiveCursor.data();\n\n  // observing the changes\n  server.collection('users').filter(user=>user.id==userId).onChange(({prev,next})=>{\n    console.log('previus user data',state.prev);\n    console.log('next user data',state.next);\n  });\n\n  // observing changes in reactive data source\n  userReactiveCursor.onChange((newData)=>{\n    console.log('new user state', newData);\n  });\n\n  let participantsSub = server.subscribe(&quot;participants&quot;);\n\n  await participantsSub.ready();\n\n  let reactiveCollection = server.collection('participants').reactive();\n\n  // reactive reduce\n  let reducedReactive = reactiveCollection.reduce((acc,val,i,arr)=>{\n    if (i&lt;arr.length-1)  {\n      return acc + val.age;\n    } else {\n      return (acc + val.age)/arr.length;\n    }\n  },0);\n\n  // reactive mean age of all participants\n  let meanAge = reducedReactive.data();\n\n  // observing changes in reactive data source\n  userReactiveCursor.onChange((newData)=>{\n    console.log('new user state', newData);\n  });\n})();\n</code></pre></article>\n    </section>\n\n\n\n\n\n\n        \n\n        <footer class=\"content-size\">\n            <div class=\"footer\">\n                Documentation generated by <a target=\"_blank\" href=\"https://github.com/jsdoc3/jsdoc\">JSDoc 3.6.3</a> on Wed Aug 07 2019 02:35:33 GMT+0300 (MSK)\n            </div>\n        </footer>\n    </div>\n</div>\n<script>prettyPrint();</script>\n<script src=\"scripts/main.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "docs/scripts/main.js",
    "content": "(function(){var e=0;var a;var t=document.getElementById(\"source-code\");if(t){var n=config.linenums;if(n){t=t.getElementsByTagName(\"ol\")[0];a=Array.prototype.slice.apply(t.children);a=a.map(function(a){e++;a.id=\"line\"+e})}else{t=t.getElementsByTagName(\"code\")[0];a=t.innerHTML.split(\"\\n\");a=a.map(function(a){e++;return'<span id=\"line'+e+'\"></span>'+a});t.innerHTML=a.join(\"\\n\")}}})();$(function(){var e=$(\".navigation\");var a=e.find(\".list\");var t=$(\".search\");$(\"#search\").on(\"keyup\",function(t){var n=this.value.trim();if(n){var s=new RegExp(n,\"i\");e.addClass(\"searching\").removeClass(\"not-searching\").find(\"li, .itemMembers\").removeClass(\"match\");e.find(\"li\").each(function(e,a){var t=$(a);if(t.data(\"name\")&&s.test(t.data(\"name\"))){t.addClass(\"match\");t.closest(\".itemMembers\").addClass(\"match\");t.closest(\".item\").addClass(\"match\")}})}else{e.removeClass(\"searching\").addClass(\"not-searching\").find(\".item, .itemMembers\").removeClass(\"match\")}a.scrollTop(0)});$(\"#menuToggle\").click(function(){a.toggleClass(\"show\");t.toggleClass(\"show\")});e.addClass(\"not-searching\");var n=$(\".page-title\").data(\"filename\").replace(/\\.[a-z]+$/,\"\");var s=e.find('.item[data-name*=\"'+n+'\"]:eq(0)');if(s.length){s.remove().prependTo(a).addClass(\"current\")}if(config.disqus){$(window).on(\"load\",function(){var e=config.disqus;var a=document.createElement(\"script\");a.type=\"text/javascript\";a.async=true;a.src=\"http://\"+e+\".disqus.com/embed.js\";(document.getElementsByTagName(\"head\")[0]||document.getElementsByTagName(\"body\")[0]).appendChild(a);var t=document.createElement(\"script\");t.async=true;t.type=\"text/javascript\";t.src=\"http://\"+e+\".disqus.com/count.js\";document.getElementsByTagName(\"BODY\")[0].appendChild(t)})}});"
  },
  {
    "path": "docs/scripts/prettify/Apache-License-2.0.txt",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "docs/scripts/prettify/lang-css.js",
    "content": "PR.registerLangHandler(PR.createSimpleLexer([[\"pln\",/^[\\t\\n\\f\\r ]+/,null,\" \\t\\r\\n\f\"]],[[\"str\",/^\"(?:[^\\n\\f\\r\"\\\\]|\\\\(?:\\r\\n?|\\n|\\f)|\\\\[\\S\\s])*\"/,null],[\"str\",/^'(?:[^\\n\\f\\r'\\\\]|\\\\(?:\\r\\n?|\\n|\\f)|\\\\[\\S\\s])*'/,null],[\"lang-css-str\",/^url\\(([^\"')]*)\\)/i],[\"kwd\",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\\w-]|$)/i,null],[\"lang-css-kw\",/^(-?(?:[_a-z]|\\\\[\\da-f]+ ?)(?:[\\w-]|\\\\\\\\[\\da-f]+ ?)*)\\s*:/i],[\"com\",/^\\/\\*[^*]*\\*+(?:[^*/][^*]*\\*+)*\\//],[\"com\",\n/^(?:<\\!--|--\\>)/],[\"lit\",/^(?:\\d+|\\d*\\.\\d+)(?:%|[a-z]+)?/i],[\"lit\",/^#[\\da-f]{3,6}/i],[\"pln\",/^-?(?:[_a-z]|\\\\[\\da-f]+ ?)(?:[\\w-]|\\\\\\\\[\\da-f]+ ?)*/i],[\"pun\",/^[^\\s\\w\"']+/]]),[\"css\"]);PR.registerLangHandler(PR.createSimpleLexer([],[[\"kwd\",/^-?(?:[_a-z]|\\\\[\\da-f]+ ?)(?:[\\w-]|\\\\\\\\[\\da-f]+ ?)*/i]]),[\"css-kw\"]);PR.registerLangHandler(PR.createSimpleLexer([],[[\"str\",/^[^\"')]+/]]),[\"css-str\"]);\n"
  },
  {
    "path": "docs/scripts/prettify/prettify.js",
    "content": "var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;\n(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:\"0\"<=b&&b<=\"7\"?parseInt(a.substring(1),8):b===\"u\"||b===\"x\"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?\"\\\\x0\":\"\\\\x\")+a.toString(16);a=String.fromCharCode(a);if(a===\"\\\\\"||a===\"-\"||a===\"[\"||a===\"]\")a=\"\\\\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\\\u[\\dA-Fa-f]{4}|\\\\x[\\dA-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\S\\s]|[^\\\\]/g),a=\n[],b=[],o=f[0]===\"^\",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&\"-\"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=[\"[\"];o&&b.push(\"^\");b.push.apply(b,a);for(c=0;c<\nf.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push(\"-\"),b.push(e(i[1])));b.push(\"]\");return b.join(\"\")}function y(a){for(var f=a.source.match(/\\[(?:[^\\\\\\]]|\\\\[\\S\\s])*]|\\\\u[\\dA-Fa-f]{4}|\\\\x[\\dA-Fa-f]{2}|\\\\\\d+|\\\\[^\\dux]|\\(\\?[!:=]|[()^]|[^()[\\\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j===\"(\"?++i:\"\\\\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j===\"(\"?(++i,d[i]===void 0&&(f[c]=\"(?:\")):\"\\\\\"===j.charAt(0)&&\n(j=+j.substring(1))&&j<=i&&(f[c]=\"\\\\\"+d[i]);for(i=c=0;c<b;++c)\"^\"===f[c]&&\"^\"!==f[c+1]&&(f[c]=\"\");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a===\"[\"?f[c]=h(j):a!==\"\\\\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return\"[\"+String.fromCharCode(a&-33,a|32)+\"]\"}));return f.join(\"\")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\\\u[\\da-f]{4}|\\\\x[\\da-f]{2}|\\\\[^UXux]/gi,\"\"))){s=!0;l=!1;break}}for(var r=\n{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(\"\"+g);n.push(\"(?:\"+y(g)+\")\")}return RegExp(n.join(\"|\"),l?\"gi\":\"g\")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if(\"BR\"===g||\"LI\"===g)h[s]=\"\\n\",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\\r\\n?/g,\"\\n\"):g.replace(/[\\t\\n\\r ]+/g,\" \"),h[s]=g,t[s<<1]=y,y+=g.length,\nt[s++<<1|1]=a)}}var e=/(?:^|\\s)nocode(?:\\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue(\"white-space\"));var p=l&&\"pre\"===l.substring(0,3);m(a);return{a:h.join(\"\").replace(/\\n$/,\"\"),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,\"pln\"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===\n\"string\")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b=\"pln\")}if((c=b.length>=5&&\"lang-\"===b.substring(0,5))&&!(o&&typeof o[1]===\"string\"))c=!1,b=\"src\";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),\nl=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=\"\"+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\\S\\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push([\"str\",/^(?:'''(?:[^'\\\\]|\\\\[\\S\\s]|''?(?=[^']))*(?:'''|$)|\"\"\"(?:[^\"\\\\]|\\\\[\\S\\s]|\"\"?(?=[^\"]))*(?:\"\"\"|$)|'(?:[^'\\\\]|\\\\[\\S\\s])*(?:'|$)|\"(?:[^\"\\\\]|\\\\[\\S\\s])*(?:\"|$))/,q,\"'\\\"\"]):a.multiLineStrings?m.push([\"str\",/^(?:'(?:[^'\\\\]|\\\\[\\S\\s])*(?:'|$)|\"(?:[^\"\\\\]|\\\\[\\S\\s])*(?:\"|$)|`(?:[^\\\\`]|\\\\[\\S\\s])*(?:`|$))/,\nq,\"'\\\"`\"]):m.push([\"str\",/^(?:'(?:[^\\n\\r'\\\\]|\\\\.)*(?:'|$)|\"(?:[^\\n\\r\"\\\\]|\\\\.)*(?:\"|$))/,q,\"\\\"'\"]);a.verbatimStrings&&e.push([\"str\",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push([\"com\",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,\"#\"]):m.push([\"com\",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\\b|[^\\n\\r]*)/,q,\"#\"]),e.push([\"str\",/^<(?:(?:(?:\\.\\.\\/)*|\\/?)(?:[\\w-]+(?:\\/[\\w-]+)+)?[\\w-]+\\.h|[a-z]\\w*)>/,q])):m.push([\"com\",/^#[^\\n\\r]*/,\nq,\"#\"]));a.cStyleComments&&(e.push([\"com\",/^\\/\\/[^\\n\\r]*/,q]),e.push([\"com\",/^\\/\\*[\\S\\s]*?(?:\\*\\/|$)/,q]));a.regexLiterals&&e.push([\"lang-regex\",/^(?:^^\\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|,|-=|->|\\/|\\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\\^=|\\^\\^|\\^\\^=|{|\\||\\|=|\\|\\||\\|\\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*(\\/(?=[^*/])(?:[^/[\\\\]|\\\\[\\S\\s]|\\[(?:[^\\\\\\]]|\\\\[\\S\\s])*(?:]|$))+\\/)/]);(h=a.types)&&e.push([\"typ\",h]);a=(\"\"+a.keywords).replace(/^ | $/g,\n\"\");a.length&&e.push([\"kwd\",RegExp(\"^(?:\"+a.replace(/[\\s,]+/g,\"|\")+\")\\\\b\"),q]);m.push([\"pln\",/^\\s+/,q,\" \\r\\n\\t\\xa0\"]);e.push([\"lit\",/^@[$_a-z][\\w$@]*/i,q],[\"typ\",/^(?:[@_]?[A-Z]+[a-z][\\w$@]*|\\w+_t\\b)/,q],[\"pln\",/^[$_a-z][\\w$@]*/i,q],[\"lit\",/^(?:0x[\\da-f]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+-]?\\d+)?)[a-z]*/i,q,\"0123456789\"],[\"pln\",/^\\\\[\\S\\s]?/,q],[\"pun\",/^.[^\\s\\w\"-$'./@\\\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if(\"BR\"===a.nodeName)h(a),\na.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}\nfor(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\\s)nocode(?:\\s|$)/,t=/\\r\\n?|\\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue(\"white-space\"));var p=l&&\"pre\"===l.substring(0,3);for(l=s.createElement(\"LI\");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute(\"value\",\nm);var r=s.createElement(\"OL\");r.className=\"linenums\";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className=\"L\"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode(\"\\xa0\")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn(\"cannot override language handler %s\",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\\s*</.test(m)?\"default-markup\":\"default-code\";return A[a]}function E(a){var m=\na.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\\bMSIE\\b/.test(navigator.userAgent),m=/\\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,\"\\r\"));i.nodeValue=\nj;var u=i.ownerDocument,v=u.createElement(\"SPAN\");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){\"console\"in window&&console.log(w&&w.stack?w.stack:w)}}var v=[\"break,continue,do,else,for,if,return,while\"],w=[[v,\"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile\"],\n\"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof\"],F=[w,\"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where\"],G=[w,\"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient\"],\nH=[G,\"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var\"],w=[w,\"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN\"],I=[v,\"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None\"],\nJ=[v,\"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END\"],v=[v,\"case,done,elif,esac,eval,fi,function,in,local,set,then,until\"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\\d*)/,N=/\\S/,O=u({keywords:[F,H,w,\"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END\"+\nI,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,[\"default-code\"]);k(x([],[[\"pln\",/^[^<?]+/],[\"dec\",/^<!\\w[^>]*(?:>|$)/],[\"com\",/^<\\!--[\\S\\s]*?(?:--\\>|$)/],[\"lang-\",/^<\\?([\\S\\s]+?)(?:\\?>|$)/],[\"lang-\",/^<%([\\S\\s]+?)(?:%>|$)/],[\"pun\",/^(?:<[%?]|[%?]>)/],[\"lang-\",/^<xmp\\b[^>]*>([\\S\\s]+?)<\\/xmp\\b[^>]*>/i],[\"lang-js\",/^<script\\b[^>]*>([\\S\\s]*?)(<\\/script\\b[^>]*>)/i],[\"lang-css\",/^<style\\b[^>]*>([\\S\\s]*?)(<\\/style\\b[^>]*>)/i],[\"lang-in.tag\",/^(<\\/?[a-z][^<>]*>)/i]]),\n[\"default-markup\",\"htm\",\"html\",\"mxml\",\"xhtml\",\"xml\",\"xsl\"]);k(x([[\"pln\",/^\\s+/,q,\" \\t\\r\\n\"],[\"atv\",/^(?:\"[^\"]*\"?|'[^']*'?)/,q,\"\\\"'\"]],[[\"tag\",/^^<\\/?[a-z](?:[\\w-.:]*\\w)?|\\/?>$/i],[\"atn\",/^(?!style[\\s=]|on)[a-z](?:[\\w:-]*\\w)?/i],[\"lang-uq.val\",/^=\\s*([^\\s\"'>]*(?:[^\\s\"'/>]|\\/(?=\\s)))/],[\"pun\",/^[/<->]+/],[\"lang-js\",/^on\\w+\\s*=\\s*\"([^\"]+)\"/i],[\"lang-js\",/^on\\w+\\s*=\\s*'([^']+)'/i],[\"lang-js\",/^on\\w+\\s*=\\s*([^\\s\"'>]+)/i],[\"lang-css\",/^style\\s*=\\s*\"([^\"]+)\"/i],[\"lang-css\",/^style\\s*=\\s*'([^']+)'/i],[\"lang-css\",\n/^style\\s*=\\s*([^\\s\"'>]+)/i]]),[\"in.tag\"]);k(x([],[[\"atv\",/^[\\S\\s]+/]]),[\"uq.val\"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),[\"c\",\"cc\",\"cpp\",\"cxx\",\"cyc\",\"m\"]);k(u({keywords:\"null,true,false\"}),[\"json\"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),[\"cs\"]);k(u({keywords:G,cStyleComments:!0}),[\"java\"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),[\"bsh\",\"csh\",\"sh\"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),\n[\"cv\",\"py\"]);k(u({keywords:\"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END\",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),[\"perl\",\"pl\",\"pm\"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),[\"rb\"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),[\"js\"]);k(u({keywords:\"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes\",\nhashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),[\"coffee\"]);k(x([],[[\"str\",/^[\\S\\s]+/]]),[\"regex\"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement(\"PRE\");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf(\"prettyprint\")>=0){var k=k.match(g),f,b;if(b=\n!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&\"CODE\"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName===\"pre\"||o.tagName===\"code\"||o.tagName===\"xmp\")&&o.className&&o.className.indexOf(\"prettyprint\")>=0){b=!0;break}b||((b=(b=n.className.match(/\\blinenums\\b(?::(\\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,\n250):a&&a()}for(var e=[document.getElementsByTagName(\"pre\"),document.getElementsByTagName(\"code\"),document.getElementsByTagName(\"xmp\")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\\blang(?:uage)?-([\\w.]+)(?!\\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:\"atn\",PR_ATTRIB_VALUE:\"atv\",PR_COMMENT:\"com\",PR_DECLARATION:\"dec\",PR_KEYWORD:\"kwd\",PR_LITERAL:\"lit\",\nPR_NOCODE:\"nocode\",PR_PLAIN:\"pln\",PR_PUNCTUATION:\"pun\",PR_SOURCE:\"src\",PR_STRING:\"str\",PR_TAG:\"tag\",PR_TYPE:\"typ\"}})();\n"
  },
  {
    "path": "docs/simpleDDP.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>SimpleDDP Docs</title>\n    \n    <meta name=\"description\" content=\"SimpleDDP Docs\" />\n    \n        <meta name=\"keywords\" content=\"ddp, simpleddp, websocket, meteor\" />\n        <meta name=\"keyword\" content=\"ddp, simpleddp, websocket, meteor\" />\n    \n    \n    \n    <meta property=\"og:title\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og:image\" content=\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\"/>\n    <meta property=\"og:site_name\" content=\"SimpleDDP Docs\"/>\n    <meta property=\"og:url\" content=\"\"/>\n    \n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <script src=\"scripts/prettify/prettify.js\"></script>\n    <script src=\"scripts/prettify/lang-css.js\"></script>\n    <script src=\"scripts/jquery.min.js\"></script>\n    <!--[if lt IE 9]>\n      <script src=\"//html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n    <link href=\"https://fonts.googleapis.com/css?family=Libre+Franklin:400,700\" rel=\"stylesheet\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/prettify-tomorrow.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/bootstrap.min.css\">\n    <link type=\"text/css\" rel=\"stylesheet\" href=\"styles/main.css\">\n    \n    \n    <script>\n    var config = {\"monospaceLinks\":false,\"cleverLinks\":false,\"applicationName\":\"SimpleDDP\",\"disqus\":\"\",\"googleAnalytics\":\"\",\"openGraph\":{\"title\":\"SimpleDDP Docs\",\"type\":\"website\",\"image\":\"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\"site_name\":\"SimpleDDP Docs\",\"url\":\"\"},\"meta\":{\"title\":\"SimpleDDP Docs\",\"description\":\"SimpleDDP Docs\",\"keyword\":\"ddp, simpleddp, websocket, meteor\"},\"linenums\":true,\"default\":{}};\n    </script>\n    \n\n    \n</head>\n<body>\n<div id=\"wrap\" class=\"clearfix\">\n    \n<div class=\"navigation\">\n    <h3 class=\"applicationName\"><a href=\"index.html\">SimpleDDP</a></h3>\n    <button id=\"menuToggle\" class=\"btn btn-link btn-lg menu-toggle\">\n        <span class=\"glyphicon glyphicon-menu-hamburger\"></span>\n    </button>\n    <div class=\"search\">\n        <input id=\"search\" type=\"text\" class=\"form-control input-md\" placeholder=\"Search...\">\n    </div>\n    <ul class=\"list\">\n    \n        <li class=\"item\" data-name=\"ddpCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpCollection.html\">ddpCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#exportData\"><a href=\"ddpCollection.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#fetch\"><a href=\"ddpCollection.html#fetch\">fetch</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#filter\"><a href=\"ddpCollection.html#filter\">filter</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#importData\"><a href=\"ddpCollection.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#onChange\"><a href=\"ddpCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpCollection#reactive\"><a href=\"ddpCollection.html#reactive\">reactive</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpEventListener\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpEventListener.html\">ddpEventListener</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#start\"><a href=\"ddpEventListener.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpEventListener#stop\"><a href=\"ddpEventListener.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpOnChange\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpOnChange.html\">ddpOnChange</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#start\"><a href=\"ddpOnChange.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpOnChange#stop\"><a href=\"ddpOnChange.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveCollection\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveCollection.html\">ddpReactiveCollection</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#_updateReactiveObjects\"><a href=\"ddpReactiveCollection.html#_updateReactiveObjects\">_updateReactiveObjects</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#count\"><a href=\"ddpReactiveCollection.html#count\">count</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#data\"><a href=\"ddpReactiveCollection.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#map\"><a href=\"ddpReactiveCollection.html#map\">map</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#onChange\"><a href=\"ddpReactiveCollection.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#one\"><a href=\"ddpReactiveCollection.html#one\">one</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#reduce\"><a href=\"ddpReactiveCollection.html#reduce\">reduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#settings\"><a href=\"ddpReactiveCollection.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#sort\"><a href=\"ddpReactiveCollection.html#sort\">sort</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#start\"><a href=\"ddpReactiveCollection.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveCollection#stop\"><a href=\"ddpReactiveCollection.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReactiveDocument\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReactiveDocument.html\">ddpReactiveDocument</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#data\"><a href=\"ddpReactiveDocument.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#onChange\"><a href=\"ddpReactiveDocument.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#settings\"><a href=\"ddpReactiveDocument.html#settings\">settings</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#start\"><a href=\"ddpReactiveDocument.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReactiveDocument#stop\"><a href=\"ddpReactiveDocument.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpReducer\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpReducer.html\">ddpReducer</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#data\"><a href=\"ddpReducer.html#data\">data</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#doReduce\"><a href=\"ddpReducer.html#doReduce\">doReduce</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#onChange\"><a href=\"ddpReducer.html#onChange\">onChange</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#start\"><a href=\"ddpReducer.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpReducer#stop\"><a href=\"ddpReducer.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"ddpSubscription\">\n            <span class=\"title  \">\n                \n                <a href=\"ddpSubscription.html\">ddpSubscription</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isOn\"><a href=\"ddpSubscription.html#isOn\">isOn</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isReady\"><a href=\"ddpSubscription.html#isReady\">isReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#isStopped\"><a href=\"ddpSubscription.html#isStopped\">isStopped</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#nosub\"><a href=\"ddpSubscription.html#nosub\">nosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onNosub\"><a href=\"ddpSubscription.html#onNosub\">onNosub</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#onReady\"><a href=\"ddpSubscription.html#onReady\">onReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#ready\"><a href=\"ddpSubscription.html#ready\">ready</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#remove\"><a href=\"ddpSubscription.html#remove\">remove</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#restart\"><a href=\"ddpSubscription.html#restart\">restart</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#start\"><a href=\"ddpSubscription.html#start\">start</a></li>\n            \n                <li class=\"parent  \" data-name=\"ddpSubscription#stop\"><a href=\"ddpSubscription.html#stop\">stop</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n        <li class=\"item\" data-name=\"simpleDDP\">\n            <span class=\"title  \">\n                \n                <a href=\"simpleDDP.html\">simpleDDP</a>\n            </span>\n            <ul class=\"members itemMembers\">\n            \n            <span class=\"subtitle\">Members</span>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#collections\"><a href=\"simpleDDP.html#collections\">collections</a></li>\n            \n                <li class=\"parent \" data-name=\"simpleDDP#connected\"><a href=\"simpleDDP.html#connected\">connected</a></li>\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"typedefs itemMembers\">\n            \n            </ul>\n            <ul class=\"methods itemMembers\">\n            \n            <span class=\"subtitle\">Methods</span>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#apply\"><a href=\"simpleDDP.html#apply\">apply</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#call\"><a href=\"simpleDDP.html#call\">call</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#clearData\"><a href=\"simpleDDP.html#clearData\">clearData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#collection\"><a href=\"simpleDDP.html#collection\">collection</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#connect\"><a href=\"simpleDDP.html#connect\">connect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#disconnect\"><a href=\"simpleDDP.html#disconnect\">disconnect</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#exportData\"><a href=\"simpleDDP.html#exportData\">exportData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#importData\"><a href=\"simpleDDP.html#importData\">importData</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#markAsReady\"><a href=\"simpleDDP.html#markAsReady\">markAsReady</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#on\"><a href=\"simpleDDP.html#on\">on</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#stopChangeListeners\"><a href=\"simpleDDP.html#stopChangeListeners\">stopChangeListeners</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#sub\"><a href=\"simpleDDP.html#sub\">sub</a></li>\n            \n                <li class=\"parent  \" data-name=\"simpleDDP#subscribe\"><a href=\"simpleDDP.html#subscribe\">subscribe</a></li>\n            \n            </ul>\n            <ul class=\"events itemMembers\">\n            \n            </ul>\n        </li>\n    \n    </ul>\n</div>\n    <div class=\"main\">\n        <h1 class=\"page-title\" data-filename=\"simpleDDP.html\">Class: simpleDDP</h1>\n        \n\n\n\n<section>\n    \n<header>\n    <div class=\"header content-size\">\n        <h2>simpleDDP\n        </h2>\n        \n            <div class=\"class-description\"><p>Creates an instance of simpleDDP class. After being constructed, the instance will\nestablish a connection with the DDP server and will try to maintain it open.</p></div>\n        \n    </div>\n</header>  \n\n<article class=\"content-size\">\n    <div class=\"container-overview\">\n    \n    \n    \n        \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"simpleDDP\">\n            <a class=\"share-icon\" href=\"#simpleDDP\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                new simpleDDP\n            </span>\n            <span class=\"signature\">(options, <span class=\"optional\">plugins</span>)</span><span class=\"type-signature\"><a href=\"simpleDDP.html\">simpleDDP</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>options</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                \n                \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>endpoint</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>The location of the websocket server. Its format depends on the type of socket you are using. If you are using https connection you have to use wss:// protocol.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>SocketConstructor</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>The constructor function that will be used to construct the socket. Meteor (currently the only DDP server available) supports websockets and SockJS sockets. So, practically speaking, this means that on the browser you can use either the browser's native WebSocket constructor or the SockJS constructor provided by the SockJS library. On the server you can use whichever library implements the websocket protocol (e.g. faye-websocket).</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>autoConnect</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">boolean</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    true\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Whether to establish the connection to the server upon instantiation. When false, one can manually establish the connection with the connect method.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>autoReconnect</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">boolean</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    true\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Whether to try to reconnect to the server when the socket connection closes, unless the closing was initiated by a call to the disconnect method.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>reconnectInterval</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">number</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    1000\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>The interval in ms between reconnection attempts.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>clearDataOnReconnection</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">boolean</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    true\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Whether to clear all collections data after a reconnection. This invokes fake <code>removed</code> messages on every document.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>maxTimeout</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">number</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Maximum wait for a response from the server to the method call. Default no maxTimeout.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n            </td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>plugins</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Array</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Array of plugins.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    <dt class=\"tag-version\">Version:</dt>\n    <dd class=\"tag-version\"><ul class=\"dummy\"><li>2.2.4</li></ul></dd>\n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"simpleDDP.html\">simpleDDP</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>A new simpleDDP instance.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n        <h5>Example</h5>\n        \n\n    \n    <pre class=\"prettyprint\"><code>var opts = {\n   endpoint: \"ws://someserver.com/websocket\",\n   SocketConstructor: WebSocket,\n   reconnectInterval: 5000\n};\nvar server = new simpleDDP(opts);</code></pre>\n    \n\n    \n</dd>\n\n    \n    </div>\n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n        <h3 class=\"subsection-title\">Members</h3>\n        \n        <dl class=\"list-members\">\n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"collections\">\n            <a class=\"share-icon\" href=\"#collections\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">collections</span>\n            <span class=\"type-signature type\">Object</span>\n            \n            \n            \n            \n        </h4>\n    </div>\n    \n    \n</dt>\n<dd>\n    \n    <div class=\"description\">\n        <p>All collections data recieved from server.</p>\n    </div>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"connected\">\n            <a class=\"share-icon\" href=\"#connected\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">connected</span>\n            <span class=\"type-signature type\">Boolean</span>\n            \n            \n            \n            \n        </h4>\n    </div>\n    \n    \n</dt>\n<dd>\n    \n    <div class=\"description\">\n        <p>Whether the client is connected to server.</p>\n    </div>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n</dd>\n\n        </dl>\n    \n    \n    \n        <h3 class=\"subsection-title\">Methods</h3>\n        \n        <dl class=\"list-methods\">\n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"apply\">\n            <a class=\"share-icon\" href=\"#apply\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                apply\n            </span>\n            <span class=\"signature\">(method, <span class=\"optional\">arguments</span>, <span class=\"optional\">atBeginning</span>)</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Calls a remote method with arguments passed in array.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>method</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>Name of the server publication.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>arguments</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Array</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Array of parameters to pass to the remote method. Pass an empty array or don't pass anything if you do not wish to pass any parameters.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>atBeginning</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">boolean</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    false\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>If true puts method call at the beginning of the requests queue.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Promise object, which resolves when receives a result send by server and rejects when receives an error send by server.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n        <h5>Example</h5>\n        \n\n    \n    <pre class=\"prettyprint\"><code>server.apply(\"method1\").then(function(result) {\n\tconsole.log(result); //show result message in console\n   if (result.someId) {\n       //server sends us someId, lets call next method using this id\n       return server.apply(\"method2\",[result.someId]);\n   } else {\n       //we didn't recieve an id, lets throw an error\n       throw \"no id sent\";\n   }\n}).then(function(result) {\n   console.log(result); //show result message from second method\n}).catch(function(error) {\n   console.log(result); //show error message in console\n});</code></pre>\n    \n\n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"call\">\n            <a class=\"share-icon\" href=\"#call\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                call\n            </span>\n            <span class=\"signature\">(method, <span class=\"optional\">args</span>)</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Calls a remote method with arguments passed after the first argument.\nSyntactic sugar for @see apply.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>method</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>Name of the server publication.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>args</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">any</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                        <span class=\"repeatable\">repeatable</span>\n                    \n                \n                <p>List of parameters to pass to the remote method. Parameters are passed as function arguments.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Promise object, which resolves when receives a result send by server and rejects when receives an error send by server.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"clearData\">\n            <a class=\"share-icon\" href=\"#clearData\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                clearData\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Removes all documents like if it was removed by the server publication.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Resolves when data is successfully removed.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"collection\">\n            <a class=\"share-icon\" href=\"#collection\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                collection\n            </span>\n            <span class=\"signature\">(name)</span><span class=\"type-signature\"><a href=\"ddpCollection.html\">ddpCollection</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Use this for fetching the subscribed data and for reactivity inside the collection.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>name</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Collection name.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"ddpCollection.html\">ddpCollection</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"connect\">\n            <a class=\"share-icon\" href=\"#connect\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                connect\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Connects to the ddp server. The method is called automatically by the class constructor if the autoConnect option is set to true (default behavior).</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Promise which resolves when connection is established.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"disconnect\">\n            <a class=\"share-icon\" href=\"#disconnect\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                disconnect\n            </span>\n            <span class=\"signature\">()</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Disconnects from the ddp server by closing the WebSocket connection. You can listen on the disconnected event to be notified of the disconnection.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Promise which resolves when connection is closed.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"exportData\">\n            <a class=\"share-icon\" href=\"#exportData\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                exportData\n            </span>\n            <span class=\"signature\">(<span class=\"optional\">format</span>)</span><span class=\"type-signature\">Object | string</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Exports the data</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t<th>Default</th>\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>format</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n                <td class=\"default\">\n                \n                    'string'\n                \n                </td>\n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Possible values are 'string' (EJSON string) and 'raw' (EJSON).</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Object\n                         | \n                    \n                        string\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>EJSON string or EJSON.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"importData\">\n            <a class=\"share-icon\" href=\"#importData\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                importData\n            </span>\n            <span class=\"signature\">(data)</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Imports the data like if it was published by the server.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>data</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Object</span>\n|\n\n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>ESJON string or EJSON.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Resolves when data is successfully imported.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"markAsReady\">\n            <a class=\"share-icon\" href=\"#markAsReady\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                markAsReady\n            </span>\n            <span class=\"signature\">(subs)</span><span class=\"type-signature\">Promise</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Marks every passed @see ddpSubscription object as ready like if it was done by the server publication.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>subs</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Array</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Array of @see ddpSubscription objects.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        Promise\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Resolves when all passed subscriptions are marked as ready.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"on\">\n            <a class=\"share-icon\" href=\"#on\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                on\n            </span>\n            <span class=\"signature\">(event, f)</span><span class=\"type-signature\"><a href=\"ddpEventListener.html\">ddpEventListener</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Starts listening server for basic DDP event running f each time the message arrives.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>event</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Any event name from DDP specification.\nDefault suppoted events: <code>connected</code>, <code>disconnected</code>, <code>added</code>, <code>changed</code>, <code>removed</code>, <code>ready</code>, <code>nosub</code>, <code>error</code>, <code>ping</code>, <code>pong</code>.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>f</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">function</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                <p>Function which receives a message from a DDP server as a first argument each time server is invoking event.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"ddpEventListener.html\">ddpEventListener</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n        <h5>Example</h5>\n        \n\n    \n    <pre class=\"prettyprint\"><code>server.on('connected', () => {\n    // you can show a success message here\n});\n\nserver.on('disconnected', () => {\n    // you can show a reconnection message here\n});</code></pre>\n    \n\n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"stopChangeListeners\">\n            <a class=\"share-icon\" href=\"#stopChangeListeners\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                stopChangeListeners\n            </span>\n            <span class=\"signature\">()</span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Stops all reactivity.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"sub\">\n            <a class=\"share-icon\" href=\"#sub\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                sub\n            </span>\n            <span class=\"signature\">(pubname, <span class=\"optional\">arguments</span>)</span><span class=\"type-signature\"><a href=\"ddpSubscription.html\">ddpSubscription</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Tries to subscribe to a specific publication on server.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>pubname</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>Name of the publication on server.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>arguments</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Array</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                \n                <p>Array of parameters to pass to the remote method. Pass an empty array or don't pass anything if you do not wish to pass any parameters.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"ddpSubscription.html\">ddpSubscription</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Subscription.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        \n            \n<dt>\n    <div class=\"nameContainer\">\n        <h4 class=\"name\" id=\"subscribe\">\n            <a class=\"share-icon\" href=\"#subscribe\"><span class=\"glyphicon glyphicon-link\"></span></a>\n            <span class=\"\">\n                subscribe\n            </span>\n            <span class=\"signature\">(pubname, <span class=\"optional\">args</span>)</span><span class=\"type-signature\"><a href=\"ddpSubscription.html\">ddpSubscription</a></span>\n            \n            \n            \n            \n        </h4>\n    \n        \n    </div>\n\n    \n</dt>\n<dd>\n    \n    \n    <div class=\"description\">\n        <p>Tries to subscribe to a specific publication on server.\nSyntactic sugar for @see sub.</p>\n    </div>\n    \n\n    \n    \n    \n    \n    \n        \n\n<table class=\"params\">\n    <thead>\n\t<tr>\n\t\t\n\t\t<th>Name</th>\n\t\t\n\t\t\n\t\t<th>Type</th>\n\t\t\n\t\t\n\t\t\n\t\t<th class=\"last\">Description</th>\n\t</tr>\n\t</thead>\n\t\n\t<tbody>\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>pubname</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">string</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                    \n                    \n                        \n                    \n                \n                <p>Name of the publication on server.</p></td>\n        </tr>\n\t\n\t\n\t\n        <tr>\n            \n                <td class=\"name\"><code>args</code></td>\n            \n            \n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">any</span>\n\n\n            \n            </td>\n            \n            \n            \n            <td class=\"description last\">\n                \n                    \n                        <span class=\"optional\">optional</span>\n                    \n                    \n                        \n                    \n                        <span class=\"repeatable\">repeatable</span>\n                    \n                \n                <p>List of parameters to pass to the remote method. Parameters are passed as function arguments.</p></td>\n        </tr>\n\t\n\t\n\t</tbody>\n</table>\n    \n    \n    \n<dl class=\"details\">\n    \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n</dl>\n\n    \n    \n\n    \n\n    \n    \n    \n    \n    \n    <h5>Returns:</h5>\n    \n\n\n<table class=\"params\">\n    <thead>\n    <tr>\n        \n        <th>Type</th>\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n    <tbody>\n    \n        <tr>\n            \n            <td class=\"type\">\n            \n                        <a href=\"ddpSubscription.html\">ddpSubscription</a>\n                        \n                    \n            </td>\n            <td class=\"description last\"><ul>\n<li>Subscription.</li>\n</ul></td>\n        </tr>\n    \n    </tbody>\n</table>\n\n    \n    \n    \n</dd>\n\n        </dl>\n    \n    \n    \n    \n    \n\n    \n</article>\n\n</section>  \n\n\n\n\n\n        \n\n        <footer class=\"content-size\">\n            <div class=\"footer\">\n                Documentation generated by <a target=\"_blank\" href=\"https://github.com/jsdoc3/jsdoc\">JSDoc 3.6.3</a> on Wed Aug 07 2019 02:35:33 GMT+0300 (MSK)\n            </div>\n        </footer>\n    </div>\n</div>\n<script>prettyPrint();</script>\n<script src=\"scripts/main.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "docs/styles/main.css",
    "content": "body,html{font-family:'Libre Franklin',sans-serif;background-color:#ecedf1;color:#333}ol,ul{margin:0;padding:0}li{list-style-type:none}#wrap{position:relative}.list::-webkit-scrollbar{width:8px;background-color:transparent}.list::-webkit-scrollbar-thumb{background-color:#647086;border-radius:4px}.navigation{position:fixed;overflow:hidden;min-width:250px;width:25%;top:0;left:0;bottom:0;background-color:#272d37}.navigation .menu-toggle{display:none}@media screen and (max-width:768px){.navigation{left:0;position:relative;width:100%;overflow:auto}.navigation .list,.navigation .search{display:none}.navigation .list.show,.navigation .search.show{display:block;position:static}.navigation .menu-toggle{display:block;position:absolute;top:10px;right:10px}}.navigation .applicationName{margin:0;padding:20px;font-weight:700;white-space:nowrap;color:#fff}.navigation .applicationName a{color:#fff}.navigation .search{padding:0 20px}.navigation .search input{background-color:#14171d;color:#fff;border-color:#3d495a}.navigation .list{padding:20px;position:absolute;overflow:auto;-webkit-overflow-scrolling:touch;width:100%;top:100px;bottom:0}.navigation li.item{margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid #3d495a;overflow:hidden}.navigation li.item a{color:#647086}.navigation li.item a:hover{color:#fff}.navigation li.item .title{display:block}.navigation li.item .title a{display:block;color:#cfd4db}.navigation li.item .title a:hover{color:#fff}.navigation li.item .title.namespace a{color:#fff}.navigation li.item .title .namespaceTag{display:inline-block;border-radius:3px;background-color:#c2185b;color:#fff;font-size:70%;padding:2px 6px;float:left;margin-right:10px;pointer-events:none}.navigation li.item .subtitle{margin:10px 0;font-weight:700;color:#c2185b;display:block;letter-spacing:.05em}.navigation li.item ul>li{padding-left:10px;font-size:.9em}.navigation li.item .itemMembers li.parent a{color:#a9b3c3}.navigation .item,.navigation .itemMembers,.navigation .itemMembers li{display:none}.navigation.not-searching .item{display:block}.navigation.not-searching .item.current .itemMembers,.navigation.not-searching .item.current .itemMembers li{display:block}.navigation.searching .item.match{display:block}.navigation.searching .item.match .itemMembers li.match,.navigation.searching .item.match .itemMembers.match{display:block}.content-size{max-width:1000px;min-width:300px;margin-left:auto;margin-right:auto}.status-deprecated{text-decoration:line-through;opacity:.4}.status-deprecated a,.status-deprecated:hover{text-decoration:none}.main{left:25%;position:fixed;height:100%;right:0;overflow:auto;-webkit-overflow-scrolling:touch;word-break:break-word}.main .summary-list dt{width:100%;margin-bottom:4px;float:left;font-size:110%}@media screen and (min-width:768px){.main .summary-list dt{width:50%}}@media screen and (min-width:991px){.main .summary-list dt{width:33.33%}}@media screen and (min-width:1200px){.main .summary-list dt{width:25%}}@media screen and (max-width:1000px){.main{left:250px}}@media screen and (max-width:768px){.main{left:0;position:static}}.main img{max-width:100%}.main article{padding:20px}.main header{background:#fff}.main header .class-description{font-size:120%}.main header .header{padding:20px}.main header .header h2{font-weight:700}.main .page-title{display:none}.main .access-signature{font-weight:400;display:inline-block;border-radius:3px;background-color:#79859a;color:#fff;font-size:.7em;padding:2px 6px;margin-left:6px}.main .access-signature.deprecated{background-color:#e91e63;font-weight:700}.main .access-signature.deprecated .deprecated-info{font-weight:400;margin-left:5px}.main .access-signature a{color:#fff}.main h4.name .type-signature{font-weight:400;font-size:.8em;color:#79859a}.main h4.name .type-signature:before{content:' : ';opacity:.6}.main h4.name .return-symbol{margin:0 6px;color:#79859a;font-size:80%}.main h4.name .share-icon{font-size:70%;color:#79859a}.main .subsection-title{color:#e91e63}.main .description{margin-top:10px}.main .description ol,.main .description ul{margin-bottom:15px}.main .description h2{font-weight:700;margin-top:30px;margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid #efefef}.main .description pre{margin:10px 0}.main .tag-source{font-size:85%}.main dt.tag-source{margin-top:5px}.main dt.tag-default{color:#79859a}.main .nameContainer{position:relative}.main .nameContainer .tag-source{position:absolute;top:0;right:0;padding:2px 6px;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background-color:#b3b7c3}.main .nameContainer .tag-source a{color:#fff;font-weight:400}.main .nameContainer h4{font-weight:700;padding:20px 0 0;border-top:1px solid #c8c9cc}.main .nameContainer h4 .signature{font-weight:400;font-size:.8em;padding-left:.4em}.main table{width:100%;margin-bottom:15px;margin-top:5px}.main table th{padding:3px 3px;color:#fff;font-weight:400;background:#79859a}.main table td{vertical-align:top;padding:5px 3px;word-break:normal}.main table tbody tr:nth-child(odd){background-color:#fff}.main table tbody tr:nth-child(even){background-color:#f5f5fb}.main table .type{color:#79859a}.main table .attributes{color:#79859a}.main table .description p{margin:0}.main table .optional{float:left;border-radius:3px;background-color:#b3b7c3;padding:2px 4px;margin-right:5px;color:#fff;font-size:80%}.main .readme p{margin-top:15px}.main .readme h1{font-weight:700}.main .readme h2{font-weight:700;margin-top:30px;margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid #79859a}.main .readme h3{color:#e91e63}.main .readme li{margin-bottom:10px}.main article ol,.main article ul{margin-left:25px}.main article ol>li{list-style-type:decimal;margin-bottom:5px}.main article ul>li{margin-bottom:5px;list-style-type:disc}.footer{margin:0 20px 20px;padding-top:20px;text-align:right;font-size:.9em;color:#79859a;border-top:1px solid #c8c9cc}"
  },
  {
    "path": "docs/styles/prettify-jsdoc.css",
    "content": "/* JSDoc prettify.js theme */\n\n/* plain text */\n.pln {\n  color: #000000;\n  font-weight: normal;\n  font-style: normal;\n}\n\n/* string content */\n.str {\n  color: #006400;\n  font-weight: normal;\n  font-style: normal;\n}\n\n/* a keyword */\n.kwd {\n  color: #000000;\n  font-weight: bold;\n  font-style: normal;\n}\n\n/* a comment */\n.com {\n  font-weight: normal;\n  font-style: italic;\n}\n\n/* a type name */\n.typ {\n  color: #000000;\n  font-weight: normal;\n  font-style: normal;\n}\n\n/* a literal value */\n.lit {\n  color: #006400;\n  font-weight: normal;\n  font-style: normal;\n}\n\n/* punctuation */\n.pun {\n  color: #000000;\n  font-weight: bold;\n  font-style: normal;\n}\n\n/* lisp open bracket */\n.opn {\n  color: #000000;\n  font-weight: bold;\n  font-style: normal;\n}\n\n/* lisp close bracket */\n.clo {\n  color: #000000;\n  font-weight: bold;\n  font-style: normal;\n}\n\n/* a markup tag name */\n.tag {\n  color: #006400;\n  font-weight: normal;\n  font-style: normal;\n}\n\n/* a markup attribute name */\n.atn {\n  color: #006400;\n  font-weight: normal;\n  font-style: normal;\n}\n\n/* a markup attribute value */\n.atv {\n  color: #006400;\n  font-weight: normal;\n  font-style: normal;\n}\n\n/* a declaration */\n.dec {\n  color: #000000;\n  font-weight: bold;\n  font-style: normal;\n}\n\n/* a variable name */\n.var {\n  color: #000000;\n  font-weight: normal;\n  font-style: normal;\n}\n\n/* a function name */\n.fun {\n  color: #000000;\n  font-weight: bold;\n  font-style: normal;\n}\n\n/* Specify class=linenums on a pre to get line numbering */\nol.linenums {\n  margin-top: 0;\n  margin-bottom: 0;\n}\n"
  },
  {
    "path": "docs/styles/prettify-tomorrow.css",
    "content": "/* Tomorrow Theme */\n/* Original theme - https://github.com/chriskempson/tomorrow-theme */\n/* Pretty printing styles. Used with prettify.js. */\n/* SPAN elements with the classes below are added by prettyprint. */\n/* plain text */\n.pln {\n  color: #4d4d4c; }\n\n@media screen {\n  /* string content */\n  .str {\n    color: #718c00; }\n\n  /* a keyword */\n  .kwd {\n    color: #8959a8; }\n\n  /* a comment */\n  .com {\n    color: #8e908c; }\n\n  /* a type name */\n  .typ {\n    color: #4271ae; }\n\n  /* a literal value */\n  .lit {\n    color: #f5871f; }\n\n  /* punctuation */\n  .pun {\n    color: #4d4d4c; }\n\n  /* lisp open bracket */\n  .opn {\n    color: #4d4d4c; }\n\n  /* lisp close bracket */\n  .clo {\n    color: #4d4d4c; }\n\n  /* a markup tag name */\n  .tag {\n    color: #c82829; }\n\n  /* a markup attribute name */\n  .atn {\n    color: #f5871f; }\n\n  /* a markup attribute value */\n  .atv {\n    color: #3e999f; }\n\n  /* a declaration */\n  .dec {\n    color: #f5871f; }\n\n  /* a variable name */\n  .var {\n    color: #c82829; }\n\n  /* a function name */\n  .fun {\n    color: #4271ae; } }\n/* Use higher contrast and text-weight for printable form. */\n@media print, projection {\n  .str {\n    color: #060; }\n\n  .kwd {\n    color: #006;\n    font-weight: bold; }\n\n  .com {\n    color: #600;\n    font-style: italic; }\n\n  .typ {\n    color: #404;\n    font-weight: bold; }\n\n  .lit {\n    color: #044; }\n\n  .pun, .opn, .clo {\n    color: #440; }\n\n  .tag {\n    color: #006;\n    font-weight: bold; }\n\n  .atn {\n    color: #404; }\n\n  .atv {\n    color: #060; } }\n/* Style */\n/*\npre.prettyprint {\n  background: white;\n  font-family: Menlo, Monaco, Consolas, monospace;\n  font-size: 12px;\n  line-height: 1.5;\n  border: 1px solid #ccc;\n  padding: 10px; }\n*/\n\n/* Specify class=linenums on a pre to get line numbering */\nol.linenums {\n  margin-top: 0;\n  margin-bottom: 0; }\n\n/* IE indents via margin-left */\nli.L0,\nli.L1,\nli.L2,\nli.L3,\nli.L4,\nli.L5,\nli.L6,\nli.L7,\nli.L8,\nli.L9 {\n  /* */ }\n\n/* Alternate shading for lines */\nli.L1,\nli.L3,\nli.L5,\nli.L7,\nli.L9 {\n  /* */ }\n"
  },
  {
    "path": "jsdoc_conf.json",
    "content": "{\n    \"plugins\": [\n        \"plugins/markdown\"\n    ],\n    \"recurseDepth\": 10,\n    \"source\": {\n        \"include\": [ \"./src/simpleddp.js\", \"./src/classes\", \"./README.md\"]\n    },\n    \"sourceType\": \"module\",\n    \"tags\": {\n        \"allowUnknownTags\": true,\n        \"dictionaries\": [\"jsdoc\",\"closure\"]\n    },\n    \"templates\": {\n        \"applicationName\": \"SimpleDDP\",\n        \"disqus\": \"\",\n        \"googleAnalytics\": \"\",\n        \"openGraph\": {\n            \"title\": \"SimpleDDP Docs\",\n            \"type\": \"website\",\n            \"image\": \"https://github.com/Gregivy/simpleddp/raw/2.x.x/simpleddp.png\",\n            \"site_name\": \"SimpleDDP Docs\",\n            \"url\": \"\"\n        },\n        \"meta\": {\n            \"title\": \"SimpleDDP Docs\",\n            \"description\": \"SimpleDDP Docs\",\n            \"keyword\": \"ddp, simpleddp, websocket, meteor\"\n        },\n        \"linenums\": true\n    },\n    \"opts\": {\n        \"encoding\": \"utf8\",\n        \"recurse\": true,\n        \"private\": false,\n        \"lenient\": true,\n        \"destination\": \"./docs\",\n        \"template\": \"./node_modules/@pixi/jsdoc-template\"\n    }\n}\n"
  },
  {
    "path": "notes.md",
    "content": "# Notes\n\n## Can websocket messages arrive out-of-order?\n[link](https://stackoverflow.com/questions/11804721/can-websocket-messages-arrive-out-of-order)\nShort answer: No.\n\nLong answer:\n\nWebSocket runs over TCP, so on that level @EJP 's answer applies. WebSocket can be \"intercepted\" by intermediaries (like WS proxies): those are allowed to reorder WebSocket control frames (i.e. WS pings/pongs), but not message frames when no WebSocket extension is in place. If there is a neogiated extension in place that in principle allows reordering, then an intermediary may only do so if it understands the extension and the reordering rules that apply.\n\n## Meteor sessionId\n\nMeteor (tested v1.4-1.8) does not use sessionId for storing subscription data.\n\n## Meter subId\n\nMeteor (tested v1.4-1.8) does not use store subscription data associated with subscription id.\nThis means that if you subscribe to some publication, close socket connection, make some changes on server\nin data being published and then reconnect to server and subscribe with the same id\nthat previous subscription had, you won't receive any `changed` or `removed` messages.\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"simpleddp\",\n  \"version\": \"2.3.0\",\n  \"description\": \"The aim of this library is to simplify the process of working with meteor server over DDP protocol using external JS environments\",\n  \"keywords\": [\n    \"ddp\",\n    \"simpleddp\",\n    \"simple\",\n    \"ddpjs\",\n    \"ddp.js\",\n    \"DDP\",\n    \"WebSocket\",\n    \"client\",\n    \"meteor\"\n  ],\n  \"main\": \"lib/simpleddp.js\",\n  \"scripts\": {\n    \"test\": \"npm run build && mocha\",\n    \"docs\": \"jsdoc -c jsdoc_conf.json\",\n    \"build\": \"rm -rf lib && babel src --out-dir lib --no-comments\",\n    \"prepare\": \"npm run build\",\n    \"prepublish\": \"npm run build\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/Gregivy/simpleddp.git\"\n  },\n  \"author\": \"Plyusch Gregory (aka Gregivy)\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/Gregivy/simpleddp/issues\"\n  },\n  \"homepage\": \"https://gregivy.github.io/simpleddp/\",\n  \"dependencies\": {\n    \"clone-deep\": \"^4.0.1\",\n    \"ejson\": \"^2.2.0\"\n  },\n  \"devDependencies\": {\n    \"@pixi/jsdoc-template\": \"^2.4.2\",\n    \"babel-cli\": \"^6.26.0\",\n    \"babel-core\": \"^6.26.3\",\n    \"babel-plugin-add-module-exports\": \"^1.0.2\",\n    \"babel-preset-env\": \"^1.7.0\",\n    \"babel-preset-stage-0\": \"^6.24.1\",\n    \"chai\": \"^4.2.0\",\n    \"jsdoc\": \"^3.6.3\",\n    \"mocha\": \"^5.2.0\",\n    \"ws\": \"^6.2.1\"\n  }\n}\n"
  },
  {
    "path": "src/classes/ddpCollection.js",
    "content": "import { fullCopy } from '../helpers/fullCopy.js';\nimport { ddpOnChange } from './ddpOnChange.js';\nimport { ddpReactiveCollection } from './ddpReactiveCollection.js';\n\n/**\n * DDP collection class.\n * @constructor\n * @param {String} name - Collection name.\n * @param {simpleDDP} server - simpleDDP instance.\n */\n\nexport class ddpCollection {\n  constructor(name,server) {\n    this._name = name;\n    this._server = server;\n    this._filter = false;\n\t}\n\n  /**\n   * Allows to specify specific documents inside the collection for reactive data and fetching.\n   * Important: if you change filter function it won't change for the already created reactive objects.\n   * @public\n   * @param {Function} f - Filter function, recieves as arguments object, index and array.\n   * @return {this}\n   */\n  filter(f) {\n    this._filter = f;\n    return this;\n  }\n\n  /**\n   * Imports data inside the collection and emits all relevant events.\n   * Both string and JS object types are supported.\n   * @public\n   * @param {string|Object} data - EJSON string or EJSON or js object.\n   */\n  importData(data) {\n\t\tlet c = typeof data === 'string' ? EJSON.parse(data) : data;\n\n\t\tif (c[this._name]) {\n      c[this._name].forEach((doc,i,arr)=>{\n        if (!this._filter || (this._filter && this._filter(doc,i,arr))) {\n  \t\t\t\tthis.ddpConnection.emit('added',{\n  \t\t\t\t\tmsg: 'added',\n  \t\t\t\t\tid: doc.id,\n  \t\t\t\t\tcollection: this._name,\n  \t\t\t\t\tfields: doc.fields\n  \t\t\t\t});\n        }\n      });\n    }\n\t}\n\n  /**\n   * Exports data from the collection.\n   * @public\n   * @param {string} [format='string'] - If 'string' then returns EJSON string, if 'raw' returns js object.\n   * @return {string|Object}\n   */\n  exportData(format) {\n    let collectionCopy = {[this._name]:this.fetch()};\n    if (format === undefined || format == 'string') {\n\t\t\treturn EJSON.stringify(collectionCopy);\n\t\t} else if (format == 'raw') {\n\t\t\treturn collectionCopy;\n\t\t}\n  }\n\n  /**\n   * Returns collection data based on filter and on passed settings. Supports skip, limit and sort.\n   * Order is 'filter' then 'sort' then 'skip' then 'limit'.\n   * @public\n   * @param {Object} [settings={skip:0,limit:Infinity,sort:null}] - Skip and limit are numbers or Infinity,\n   * sort is a standard js array sort function.\n   * @return {Object}\n   */\n  fetch(settings) {\n    let skip, limit, sort;\n\n    if (settings) {\n      skip = settings.skip;\n      limit = settings.limit;\n      sort = settings.sort;\n    }\n\n    let c = this._server.collections[this._name];\n    let collectionCopy = c ? fullCopy(c) : [];\n    if (this._filter) collectionCopy = collectionCopy.filter(this._filter);\n    if (sort) collectionCopy.sort(sort);\n    if (typeof skip === 'number') collectionCopy.splice(0,skip);\n    if (typeof limit === 'number' || limit == Infinity) collectionCopy.splice(limit);\n    return collectionCopy;\n  }\n\n  /**\n   * Returns reactive collection object.\n   * @see ddpReactiveCollection\n   * @public\n   * @param {Object} [settings={skip:0,limit:Infinity,sort:null}]\n   * @return {ddpReactiveCollection}\n   */\n  reactive(settings) {\n    return new ddpReactiveCollection(this,settings,this._filter);\n  }\n\n  /**\n   * Returns change observer.\n   * @see ddpOnChange\n   * @public\n   * @param {Function} f\n   * @param {Function} filter\n   * @return {ddpOnChange}\n   */\n  onChange(f,filter) {\n    let obj = {\n      collection: this._name,\n      f: f\n    };\n\n    if (this._filter) obj.filter = this._filter;\n    if (filter) obj.filter = filter;\n\n    return new ddpOnChange(obj,this._server);\n  }\n\n}\n"
  },
  {
    "path": "src/classes/ddpEventListener.js",
    "content": "/**\n * DDP event listener class.\n * @constructor\n * @param {String} eventname - Event name.\n * @param {Function} f - Function to run when event is fired.\n * @param {simpleDDP} ddplink - simpleDDP instance.\n */\n\nexport class ddpEventListener {\n\tconstructor(eventname, f, ddplink) {\n\t\tthis._ddplink = ddplink;\n\t\tthis._eventname = eventname;\n\t\tthis._f = f;\n\t\tthis._started = false;\n\t\tthis.start();\n\t}\n\n\t/**\n   * Stops listening for server `event` messages.\n\t * You can start any stopped @see ddpEventListener at any time using `ddpEventListener.start()`.\n   * @public\n   */\n\tstop() {\n\t\tif (this._started) {\n\t\t\tthis._ddplink.ddpConnection.removeListener(this._eventname,this._f);\n\t\t\tthis._started = false;\n\t\t}\n\t}\n\n\t/**\n\t * Usually you won't need this unless you stopped the @see ddpEventListener.\n\t * @see ddpEventListener starts on creation.\n   * @public\n   */\n\tstart() {\n\t\tif (!this._started) {\n\t\t\tthis._ddplink.ddpConnection.on(this._eventname,this._f);\n\t\t\tthis._started = true;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/classes/ddpOnChange.js",
    "content": "/**\n * DDP change listener class.\n * @constructor\n * @param {Object} obj - Describes changes of interest.\n * @param {*} inst - Event handler instance.\n * @param {simpleDDP} [listenersArray = 'onChangeFuncs'] - Property name of event handler instance, array of listeners.\n */\n\nexport class ddpOnChange {\n  constructor(obj,inst,listenersArray = 'onChangeFuncs') {\n    this._obj = obj;\n    this._inst = inst;\n    this._isStopped = true;\n    this._listenersArray = listenersArray;\n    this.start();\n\t}\n\n  /**\n   * Stops change listener.\n   * @public\n   */\n  stop() {\n    let i = this._inst[this._listenersArray].indexOf(this._obj);\n    if (i>-1) {\n      this._isStopped = true;\n      this._inst[this._listenersArray].splice(i,1);\n    }\n  }\n\n  /**\n   * Start change listener. This method is being called on instance creation.\n   * @public\n   */\n  start() {\n    if (this._isStopped) {\n      this._inst[this._listenersArray].push(this._obj);\n      this._isStopped = false;\n    }\n  }\n}\n"
  },
  {
    "path": "src/classes/ddpReactiveCollection.js",
    "content": "import { ddpReducer } from './ddpReducer.js';\nimport { ddpReactiveDocument } from './ddpReactiveDocument.js';\nimport { ddpOnChange } from './ddpOnChange.js';\n\n/**\n * A reactive collection class.\n * @constructor\n * @param {ddpCollection} ddpCollection - Instance of @see ddpCollection class.\n * @param {Object} [settings={skip:0,limit:Infinity,sort:false}] - Object for declarative reactive collection slicing.\n * @param {Function} [filter=undefined] - Filter function.\n */\n\nexport class ddpReactiveCollection {\n\tconstructor(ddpCollectionInstance,settings,filter) {\n    this._skip = settings && typeof settings.skip === 'number' ? settings.skip : 0;\n    this._limit = settings && typeof settings.limit === 'number' ? settings.limit : Infinity;\n\t\tthis._sort = settings && typeof settings.sort === 'function' ? settings.sort : false;\n\n    this._length = {result:0};\n\n    this._data = [];\n    this._rawData = [];\n\n    this._reducers = [];\n\t\tthis._tickers = [];\n    this._ones = [];\n\n    this._first = {};\n\n    this._syncFunc = function (skip,limit,sort) {\n      let options = {};\n      if (typeof skip === 'number') options.skip = skip;\n      if (typeof limit === 'number') options.limit = limit;\n      if (sort) options.sort = sort;\n      return ddpCollectionInstance.fetch.call(ddpCollectionInstance,options);\n    };\n\n    this._changeHandler = ddpCollectionInstance.onChange(({prev,next,predicatePassed})=>{\n      if (prev && next) {\n        if (predicatePassed[0]==0 && predicatePassed[1]==1) {\n          // prev falling, next passing filter, adding new element with sort\n          this._smartUpdate(next);\n        } else if (predicatePassed[0]==1 && predicatePassed[1]==0) {\n          // prev passing, next falling filter, removing old element\n          let i = this._rawData.findIndex((obj)=>{\n      \t\t\treturn obj.id == prev.id;\n      \t\t});\n          this._removeItem(i);\n        } else if (predicatePassed[0]==1 && predicatePassed[1]==1) {\n          // both passing, should delete previous and add new\n          let i = this._rawData.findIndex((obj)=>{\n      \t\t\treturn obj.id == prev.id;\n      \t\t});\n          this._smartUpdate(next,i);\n        }\n      } else if (!prev && next) {\n        // element was added and is passing the filter\n        // adding new element with sort\n        this._smartUpdate(next);\n      } else if (prev && !next) {\n        // element was removed and is passing the filter, so it was in newCollection\n        // removing old element\n        let i = this._rawData.findIndex((obj)=>{\n          return obj.id == prev.id;\n        });\n         this._removeItem(i);\n      }\n      this._length.result = this._data.length;\n\n      this._reducers.forEach((reducer)=>{\n        reducer.doReduce();\n      });\n\n      if (this._data[0]!==this._first) {\n        this._updateReactiveObjects();\n      }\n\n      this._first = this._data[0];\n\n\t\t\tthis._tickers.forEach((ticker)=>{\n\t\t\t\tticker(this.data());\n\t\t\t});\n    },filter?filter:(_)=>true);\n\n    this.started = false;\n\n    this.start();\n\t}\n\n  /**\n   * Removes document from the local collection copies.\n   * @private\n   * @param {number} i - Document index in this._rawData array.\n   */\n  _removeItem(i) {\n    this._rawData.splice(i,1);\n\n    if (i >= this._skip && i<this._skip+this._limit) {\n      this._data.splice(i-this._skip,1);\n\n      if (this._rawData.length>=this._skip+this._limit) {\n        this._data.push(this._rawData[this._skip+this._limit-1]);\n      }\n    } else if (i<this._skip) {\n      this._data.shift();\n      if (this._rawData.length>=this._skip+this._limit) {\n        this._data.push(this._rawData[this._skip+this._limit-1]);\n      }\n    }\n\n  }\n\n  /**\n   * Adds document to local the collection this._rawData according to used sorting if specified.\n   * @private\n   * @param {Object} newEl - Document to be added to the local collection.\n   * @return {boolean} - The first element in the collection was changed\n   */\n  _smartUpdate(newEl,j) {\n    let placement;\n\t\tif (!this._rawData.length) {\n\t\t\tplacement = this._rawData.push(newEl) - 1;\n\t\t\tif (placement>=this._skip && placement<this._skip+this._limit) {\n\t\t\t\tthis._data.push(newEl);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n    if (this._sort) {\n      for (let i=0;i<this._rawData.length;i++) {\n        if (this._sort(newEl,this._rawData[i])<1) {\n          placement = i;\n          if (i==j) {\n            // new position is the the same\n            this._rawData[i] = newEl;\n\t\t\t\t\t\tif (j>=this._skip && j<this._skip+this._limit) {\n\t\t\t\t\t\t\tthis._data[j-this._skip] = newEl;\n\t\t\t\t\t\t}\n          } else {\n            // new position is different\n            // removing old element and adding new\n            this._removeItem(j);\n            this._rawData.splice(i,0,newEl);\n\t\t\t\t\t\tif (i>=this._skip && i<this._skip+this._limit) {\n\t\t\t\t\t\t\tthis._data.splice(i-this._skip,0,newEl);\n\t\t\t\t\t\t\tthis._data.splice(this._limit);\n\t\t\t\t\t\t}\n          }\n          break;\n        }\n        if (i==this._rawData.length-1) {\n          placement = this._rawData.push(newEl) - 1;\n\t\t\t\t\tif (placement>=this._skip && placement<this._skip+this._limit) {\n\t\t\t\t\t\tthis._data.push(newEl);\n\t\t\t\t\t}\n          break;\n        }\n      }\n    } else {\n      // no sorting, trying to change existing\n      if (typeof j === 'number') {\n        placement = j;\n        this._rawData[j] = newEl;\n\t\t\t\tif (j>=this._skip && j<this._skip+this._limit) {\n\t\t\t\t\tthis._data[j-this._skip] = newEl;\n\t\t\t\t}\n      } else {\n        placement = this._rawData.push(newEl) - 1;\n\t\t\t\tif (placement>=this._skip && placement<this._skip+this._limit) {\n\t\t\t\t\tthis._data.push(newEl);\n\t\t\t\t}\n      }\n    }\n\n  }\n\n  /**\n   * Adds reducer.\n   * @private\n   * @param {ddpReducer} reducer - A ddpReducer object that needs to be updated on changes.\n   */\n  _activateReducer(reducer) {\n    this._reducers.push(reducer);\n  }\n\n  /**\n   * Adds reactive object.\n   * @private\n   * @param {ddpReactiveDocument} o - A ddpReactiveDocument object that needs to be updated on changes.\n   */\n  _activateReactiveObject(o) {\n    this._ones.push(o);\n  }\n\n  /**\n   * Removes reducer.\n   * @private\n   * @param {ddpReducer} reducer - A ddpReducer object that does not need to be updated on changes.\n   */\n  _deactivateReducer(reducer) {\n    let i = this._reducers.indexOf(reducer);\n    if (i>-1) {\n      this._reducers.splice(i,1);\n    }\n  }\n\n  /**\n   * Removes reactive object.\n   * @private\n   * @param {ddpReactiveDocument} o - A ddpReducer object that does not need to be updated on changes.\n   */\n  _deactivateReactiveObject(o) {\n    let i = this._ones.indexOf(o);\n    if (i>-1) {\n      this._ones.splice(i,1);\n    }\n  }\n\n  /**\n   * Sends new object state for every associated reactive object.\n   * @public\n   */\n  _updateReactiveObjects() {\n    this._ones.forEach((ro)=>{\n      ro._update(this.data()[0]);\n    });\n  }\n\n  /**\n   * Updates ddpReactiveCollection settings.\n   * @public\n   * @param {Object} [settings={skip:0,limit:Infinity,sort:false}] - Object for declarative reactive collection slicing.\n\t * @return {this}\n   */\n  settings(settings) {\n\t\tlet skip, limit, sort;\n\n    if (settings) {\n      skip = settings.skip;\n      limit = settings.limit;\n      sort = settings.sort;\n    }\n\n\t\tthis._skip = skip !== undefined ? skip : this._skip;\n\t\tthis._limit = limit !== undefined ? limit : this._limit;\n\t\tthis._sort = sort !== undefined ? sort : this._sort;\n\n    this._data.splice(0,this._data.length,...this._syncFunc(this._skip,this._limit,this._sort));\n    this._updateReactiveObjects();\n\t\treturn this;\n  }\n\n\t/**\n   * Updates the skip parameter only.\n   * @public\n   * @param {number} n - A number of documents to skip.\n\t * @return {this}\n   */\n\tskip(n) {\n\t\treturn this.settings({skip:n});\n\t}\n\n\t/**\n   * Updates the limit parameter only.\n   * @public\n   * @param {number} n - A number of documents to observe.\n\t * @return {this}\n   */\n\tlimit(n) {\n\t\treturn this.settings({limit:n});\n\t}\n\n  /**\n   * Stops reactivity. Also stops associated reactive objects.\n   * @public\n   */\n  stop() {\n\t\tif (this.started) {\n\t\t\tthis._changeHandler.stop();\n\t\t\tthis.started = false;\n\t\t}\n\t}\n\n\n  /**\n   * Starts reactivity. This method is being called on instance creation.\n   * Also starts every associated reactive object.\n   * @public\n   */\n\tstart() {\n\t\tif (!this.started) {\n      this._rawData.splice(0,this._rawData.length,...this._syncFunc(false,false,this._sort));\n      this._data.splice(0,this._data.length,...this._syncFunc(this._skip,this._limit,this._sort));\n      this._updateReactiveObjects();\n\t\t\tthis._changeHandler.start();\n\t\t\tthis.started = true;\n\t\t}\n\t}\n\n  /**\n   * Sorts local collection according to specified function.\n   * Specified function form {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort}.\n   * @public\n   * @param {Function} f - A function used for sorting.\n   * @return {this}\n   */\n  sort(f) {\n    this._sort = f;\n    if (this._sort) {\n      this._rawData.splice(0,this._rawData.length,...this._syncFunc(false,false,this._sort));\n      this._data.splice(0,this._data.length,...this._syncFunc(this._skip,this._limit,this._sort));\n      this._updateReactiveObjects();\n    }\n    return this;\n  }\n\n  /**\n   * Returns reactive local collection with applied sorting, skip and limit.\n   * This returned array is being mutated within this class instance.\n   * @public\n   * @return {Array} - Local collection with applied sorting, skip and limit.\n   */\n  data() {\n    return this._data;\n  }\n\n\t/**\n\t * Runs a function every time a change occurs.\n\t * @param {Function} f - Function which recieves new collection at each change.\n\t * @public\n\t */\n\tonChange(f) {\n\t\treturn new ddpOnChange(f,this,'_tickers');\n\t}\n\n  /**\n   * Maps reactive local collection to another reactive array.\n   * Specified function form {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map}.\n   * @public\n   * @param {Function} f - Function that produces an element of the new Array.\n   * @return {ddpReducer} - Object that allows to get reactive mapped data @see ddpReducer.\n   */\n  map(f) {\n    return new ddpReducer(this,function (accumulator,el,i,a) {\n      return accumulator.concat(f(el,i,a));\n    },[]);\n  }\n\n  /**\n   * Reduces reactive local collection.\n   * Specified function form {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce}.\n   * @public\n   * @param {Function} f - Function to execute on each element in the array.\n   * @param {*} initialValue - Value to use as the first argument to the first call of the function.\n   * @return {ddpReducer} - Object that allows to get reactive object based on reduced reactive local collection @see ddpReducer.\n   */\n  reduce(f,initialValue) {\n    return new ddpReducer(this,f,initialValue);\n  }\n\n  /**\n   * Reactive length of the local collection.\n   * @public\n   * @return {Object} - Object with reactive length of the local collection. {result}\n   */\n  count() {\n    return this._length;\n  }\n\n  /**\n   * Returns a reactive object which fields are always the same as the first object in the collection.\n   * @public\n   * @param {Object} [settings={preserve:false}] - Settings for reactive object. Use {preserve:true} if you want to keep object on remove.\n   * @return {ddpReactiveDocument} - Object that allows to get reactive object based on reduced reactive local collection @see ddpReactiveDocument.\n   */\n  one(settings) {\n    return new ddpReactiveDocument(this,settings);\n  }\n\n}\n"
  },
  {
    "path": "src/classes/ddpReactiveDocument.js",
    "content": "import { ddpOnChange } from './ddpOnChange.js';\n\n/**\n * A reactive document class.\n * @constructor\n * @param {ddpReactiveCollection} ddpReactiveCollectionInstance - Instance of @see ddpReactiveCollection class.\n * @param {Object} [settings={preserve:false}] - Settings for reactive object. When preserve is true,\n * reactive object won't change when corresponding object is being deleted.\n */\n\nexport class ddpReactiveDocument{\n\tconstructor(ddpReactiveCollectionInstance,settings) {\n\t\tthis._ddpReactiveCollectionInstance = ddpReactiveCollectionInstance;\n    this._started = false;\n    this._data = {};\n\t\tthis._tickers = [];\n\t\tthis._preserve = false;\n\t\tif (typeof settings === 'object' && settings !== null) this.settings(settings);\n    this.start();\n\t}\n\n\t/**\n\t * Updates reactive object from local collection copies.\n\t * @private\n\t * @param {Object} newState - Document's new state.\n\t */\n\t_update(newState) {\n\t\tif (newState) {\n\t\t\t//clean object\n\t\t\tObject.keys(this._data).forEach((key) => { delete this._data[key]; });\n\t\t\t//assign new state\n\t\t\tObject.assign(this._data,newState);\n\t\t} else {\n\t\t\t// no object clean if not preserved\n\t\t\tif (!this._preserve) {\n\t\t\t\tObject.keys(this._data).forEach((key) => { delete this._data[key]; });\n\t\t\t}\n\t\t}\n\n\t\tthis._tickers.forEach((ticker)=>{\n\t\t\tticker(this.data());\n\t\t});\n\t}\n\n\t/**\n\t * Starts reactiveness for the document. This method is being called on instance creation.\n\t * @public\n\t */\n\tstart() {\n\t\tif (!this._started) {\n      this._update(this._ddpReactiveCollectionInstance.data()[0]);\n\t\t\tthis._ddpReactiveCollectionInstance._activateReactiveObject(this);\n\t\t\tthis._started = true;\n\t\t}\n\t}\n\n\t/**\n\t * Stops reactiveness for the document.\n\t * @public\n\t */\n\tstop() {\n\t\tif (this._started) {\n\t\t\tthis._ddpReactiveCollectionInstance._deactivateReactiveObject(this);\n\t\t\tthis._started = false;\n\t\t}\n\t}\n\n\t/**\n\t * Returns reactive document.\n\t * @public\n\t * @return {Object}\n\t */\n\tdata() {\n\t\treturn this._data;\n\t}\n\n\t/**\n\t * Runs a function every time a change occurs.\n\t * @param {Function} f - Function which recieves a new value at each change.\n\t * @public\n\t */\n\tonChange(f) {\n\t\treturn new ddpOnChange(f,this,'_tickers');\n\t}\n\n\t/**\n\t * Change reactivity settings.\n\t * @param {Object} settings\n\t * @param {boolean} settings.preserve - When preserve is true,reactive object won't change when corresponding object is being deleted.\n\t * @public\n\t */\n  settings({preserve}) {\n    this._preserve = !!preserve;\n  }\n}\n"
  },
  {
    "path": "src/classes/ddpReducer.js",
    "content": "import { ddpOnChange } from './ddpOnChange.js';\n\n/**\n * A reducer class for a reactive document.\n * @constructor\n * @param {ddpReactiveCollection} ddpReactiveCollectionInstance - Instance of @see ddpReactiveCollection class.\n * @param {Function} reducer - Function for a reduction.\n * @param {*} initialValue - Initial value for a reduction function.\n */\n\nexport class ddpReducer {\n\tconstructor(ddpReactiveCollectionInstance,reducer,initialValue) {\n    this._ddpReactiveCollectionInstance = ddpReactiveCollectionInstance;\n    this._reducer = reducer;\n    this._started = false;\n    this._data = {result:null};\n\t\tthis._tickers = [];\n    this._initialValue = initialValue;\n    this.start();\n\t}\n\n\t/**\n   * Forcibly reduces reactive data.\n   * @public\n   */\n  doReduce() {\n    if (this._started) {\n      this._data.result = this._ddpReactiveCollectionInstance.data().reduce(this._reducer,this._initialValue);\n\t\t\tthis._tickers.forEach((ticker)=>{\n\t\t\t\tticker(this.data().result);\n\t\t\t});\n    }\n  }\n\n\t/**\n\t * Starts reactiveness for the reduced value of the collection.\n\t * This method is being called on instance creation.\n\t * @public\n\t */\n  start() {\n    if (!this._started) {\n      this.doReduce();\n      this._ddpReactiveCollectionInstance._activateReducer(this);\n      this._started = true;\n    }\n  }\n\n\t/**\n\t * Stops reactiveness.\n\t * @public\n\t */\n  stop() {\n    if (this._started) {\n      this._ddpReactiveCollectionInstance._deactivateReducer(this);\n      this._started = false;\n    }\n  }\n\n\t/**\n\t * Returns reactive reduce.\n\t * @public\n\t * @return {Object} - {result:reducedValue}\n\t */\n  data() {\n    return this._data;\n  }\n\n\t/**\n\t * Runs a function every time a change occurs.\n\t * @param {Function} f - Function which recieves a reduced value at each change.\n\t * @public\n\t */\n\tonChange(f) {\n\t\treturn new ddpOnChange(f,this,'_tickers');\n\t}\n\n}\n"
  },
  {
    "path": "src/classes/ddpSubscription.js",
    "content": "/**\n * DDP subscription class.\n * @constructor\n * @param {String} pubname - Publication name.\n * @param {Array} args - Subscription arguments.\n * @param {simpleDDP} ddplink - simpleDDP instance.\n */\n\nexport class ddpSubscription {\n\tconstructor(pubname, args, ddplink) {\n\t\tthis._ddplink = ddplink;\n\t\tthis.pubname = pubname;\n\t\tthis.args = args;\n    this._nosub = false;\n\t\tthis._started = false;\n\t\tthis._ready = false;\n\n    this.selfReadyEvent = ddplink.on('ready', (m) => {\n      if (m.subs.includes(this.subscriptionId)) {\n        this._ready = true;\n        this._nosub = false;\n      }\n    });\n\n    this.selfNosubEvent = ddplink.on('nosub', (m) => {\n      if (m.id==this.subscriptionId) {\n        this._ready = false;\n        this._nosub = true;\n        this._started = false;\n      }\n    });\n\n    this.start();\n\t}\n\n\t/**\n\t * Runs everytime when `nosub` message corresponding to the subscription comes from the server.\n\t * @public\n\t * @param {Function} f - Function, event handler.\n\t * @return {ddpEventListener}\n\t */\n  onNosub(f) {\n    if (this.isStopped()) {\n      f();\n    } else {\n      let onNs = this._ddplink.on('nosub', (m) => {\n        if (m.id==this.subscriptionId) {\n          f(m.error || m);\n        }\n      });\n      return onNs;\n    }\n  }\n\n\t/**\n\t * Runs everytime when `ready` message corresponding to the subscription comes from the server.\n\t * @public\n\t * @param {Function} f - Function, event handler.\n\t * @return {ddpEventListener}\n\t */\n  onReady(f) {\n    // может приходить несколько раз, нужно ли сохранять куда-то?\n\t\tif (this.isReady()) {\n\t\t\tf();\n\t\t} else {\n\t\t\tlet onReady = this._ddplink.on('ready', (m) => {\n\t\t\t\tif (m.subs.includes(this.subscriptionId)) {\n\t\t\t\t\tf();\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn onReady;\n\t\t}\n\t}\n\n\t/**\n\t * Returns true if subsciprtion is ready otherwise false.\n\t * @public\n\t * @return {boolean}\n\t */\n  isReady() {\n    return this._ready;\n  }\n\n\t/**\n\t * Returns true if subscription is stopped otherwise false.\n\t * @public\n\t * @return {boolean}\n\t */\n  isStopped() {\n    return this._nosub;\n  }\n\n\t/**\n\t * Returns a promise which resolves when subscription is ready or rejects when `nosub` message arrives.\n\t * @public\n\t * @return {Promise}\n\t */\n  ready() {\n\t\treturn new Promise((resolve, reject) => {\n      if (this.isReady()) {\n        resolve();\n      } else {\n        let onReady = this._ddplink.on('ready', (m) => {\n  \t\t\t\tif (m.subs.includes(this.subscriptionId)) {\n  \t\t\t\t\tonReady.stop();\n            onNosub.stop();\n  \t\t\t\t\tresolve();\n  \t\t\t\t}\n  \t\t\t});\n        let onNosub = this._ddplink.on('nosub', (m) => {\n  \t\t\t\tif (m.id == this.subscriptionId) {\n  \t\t\t\t\tonNosub.stop();\n            onReady.stop();\n  \t\t\t\t\treject(m.error || m);\n  \t\t\t\t}\n  \t\t\t});\n      }\n    });\n\t}\n\n\t/**\n\t * Returns a promise which resolves when corresponding `nosub` message arrives.\n\t * Rejects when `nosub` comes with error.\n\t * @public\n\t * @return {Promise}\n\t */\n  nosub() {\n    return new Promise((resolve, reject) => {\n      if (this.isStopped()) {\n        resolve();\n      } else {\n        let onNosub = this._ddplink.on('nosub', (m) => {\n          if (m.id==this.subscriptionId) {\n            this._nosub = true;\n\n            onNosub.stop();\n\t\t\t\t\t\tif (m.error) {\n\t\t\t\t\t\t\treject(m.error);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t}\n          }\n        });\n      }\n    });\n  }\n\n\t/**\n\t * Returns true if subscription is active otherwise false.\n\t * @public\n\t * @return {Promise}\n\t */\n\tisOn() {\n\t\treturn this._started;\n\t}\n\n\t/**\n\t * Completly removes subscription.\n\t * @public\n\t */\n\tremove() {\n    // stopping nosub listener\n    this.selfNosubEvent.stop();\n    // stopping the subscription and ready listener\n\t\tthis.stop();\n    // removing from sub list inside simpleDDP instance\n    let i = this._ddplink.subs.indexOf(this);\n\t\tif (i>-1) {\n\t\t\tthis._ddplink.subs.splice(i,1);\n\t\t}\n\t}\n\n\t/**\n\t * Stops subscription and return a promise which resolves when subscription is stopped.\n\t * @public\n\t * @return {Promise}\n\t */\n\tstop() {\n\t\tif (this._started) {\n      // stopping ready listener\n      this.selfReadyEvent.stop();\n      // unsubscribing\n      if (!this._nosub) this._ddplink.ddpConnection.unsub(this.subscriptionId);\n\t\t\tthis._started = false;\n\t\t\tthis._ready = false;\n\t\t}\n    return this.nosub();\n\t}\n\n\t/**\n\t * Returns subscription id.\n\t * @private\n\t * @return {Promise}\n\t */\n\t_getId() {\n\t\treturn this.subscriptionId;\n\t}\n\n\t/**\n\t * Start the subscription. Runs on class creation.\n\t * Returns a promise which resolves when subscription is ready.\n\t * @public\n\t * @param {Array} args - Subscription arguments.\n\t * @return {Promise}\n\t */\n\tstart(args) {\n\t\tif (!this._started) {\n      // starting ready listener\n      this.selfReadyEvent.start();\n      // subscribing\n\t\t\tif (Array.isArray(args)) this.args = args;\n\t\t\tthis.subscriptionId = this._ddplink.ddpConnection.sub(this.pubname,this.args);\n\t\t\tthis._started = true;\n\t\t}\n    return this.ready();\n\t}\n\n\t/**\n\t * Restart the subscription. You can also change subscription arguments.\n\t * Returns a promise which resolves when subscription is ready.\n\t * @public\n\t * @param {Array} [args] - Subscription arguments.\n\t * @return {Promise}\n\t */\n  restart(args) {\n    return new Promise((resolve, reject) => {\n      this.stop().then(()=>{\n        this.start(args).then(()=>{\n          resolve();\n        }).catch((e)=>{reject(e)});\n      }).catch((e)=>{reject(e)});\n    });\n\t}\n}\n"
  },
  {
    "path": "src/helpers/fullCopy.js",
    "content": "import cloneDeep from 'clone-deep';\n\nexport const fullCopy = cloneDeep;\n"
  },
  {
    "path": "src/helpers/isequal.js",
    "content": "export const isEqual = function (value, other) {\n\n\t// Get the value type\n\tvar type = Object.prototype.toString.call(value);\n\n\t// If the two objects are not the same type, return false\n\tif (type !== Object.prototype.toString.call(other)) return false;\n\n\t// If items are not an object or array, return false\n\tif (['[object Array]', '[object Object]'].indexOf(type) < 0) return false;\n\n\t// Compare the length of the length of the two items\n\tvar valueLen = type === '[object Array]' ? value.length : Object.keys(value).length;\n\tvar otherLen = type === '[object Array]' ? other.length : Object.keys(other).length;\n\tif (valueLen !== otherLen) return false;\n\n\t// Compare two items\n\tvar compare = function (item1, item2) {\n\n\t\t// Get the object type\n\t\tvar itemType = Object.prototype.toString.call(item1);\n\n\t\t// If an object or array, compare recursively\n\t\tif (['[object Array]', '[object Object]'].indexOf(itemType) >= 0) {\n\t\t\tif (!isEqual(item1, item2)) return false;\n\t\t}\n\n\t\t// Otherwise, do a simple comparison\n\t\telse {\n\n\t\t\t// If the two items are not the same type, return false\n\t\t\tif (itemType !== Object.prototype.toString.call(item2)) return false;\n\n\t\t\t// Else if it's a function, convert to a string and compare\n\t\t\t// Otherwise, just compare\n\t\t\tif (itemType === '[object Function]') {\n\t\t\t\tif (item1.toString() !== item2.toString()) return false;\n\t\t\t} else {\n\t\t\t\tif (item1 !== item2) return false;\n\t\t\t}\n\n\t\t}\n\t};\n\n\t// Compare properties\n\tif (type === '[object Array]') {\n\t\tfor (var i = 0; i < valueLen; i++) {\n\t\t\tif (compare(value[i], other[i]) === false) return false;\n\t\t}\n\t} else {\n\t\tfor (var key in value) {\n\t\t\tif (value.hasOwnProperty(key)) {\n\t\t\t\tif (compare(value[key], other[key]) === false) return false;\n\t\t\t}\n\t\t}\n\t}\n\n\t// If nothing failed, return true\n\treturn true;\n};\n"
  },
  {
    "path": "src/simpleddp.js",
    "content": "import DDP from '../core';\nimport EJSON from \"ejson\";\n\nimport { isEqual } from './helpers/isequal.js';\nimport { fullCopy } from './helpers/fullCopy.js';\n\nimport { ddpEventListener } from './classes/ddpEventListener.js';\nimport { ddpSubscription } from './classes/ddpSubscription.js';\nimport { ddpCollection } from './classes/ddpCollection.js';\n\nfunction uniqueIdFuncGen() {\n\tlet idCounter = 0;\n\n\treturn function () {\n\t\treturn idCounter++;\n\t}\n}\n\nconst simpleDDPcounter = uniqueIdFuncGen();\n\nfunction connectPlugins(plugins,...places) {\n\tif (Array.isArray(plugins)) {\n\t\tplugins.forEach((p)=>{\n\t\t\tplaces.forEach((place)=>{\n\t\t\t\tif (p[place]) {\n\t\t\t\t\tp[place].call(this);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n\n/**\n * Creates an instance of simpleDDP class. After being constructed, the instance will\n * establish a connection with the DDP server and will try to maintain it open.\n * @version 2.2.4\n */\nclass simpleDDP {\n\t/**\n\t * @param {Object} options\n\t * @param {string} options.endpoint - The location of the websocket server. Its format depends on the type of socket you are using. If you are using https connection you have to use wss:// protocol.\n\t * @param {Function} options.SocketConstructor - The constructor function that will be used to construct the socket. Meteor (currently the only DDP server available) supports websockets and SockJS sockets. So, practically speaking, this means that on the browser you can use either the browser's native WebSocket constructor or the SockJS constructor provided by the SockJS library. On the server you can use whichever library implements the websocket protocol (e.g. faye-websocket).\n\t * @param {boolean} [options.autoConnect=true] - Whether to establish the connection to the server upon instantiation. When false, one can manually establish the connection with the connect method.\n\t * @param {boolean} [options.autoReconnect=true] - Whether to try to reconnect to the server when the socket connection closes, unless the closing was initiated by a call to the disconnect method.\n\t * @param {number} [options.reconnectInterval=1000] - The interval in ms between reconnection attempts.\n\t * @param {boolean} [options.clearDataOnReconnection=true] - Whether to clear all collections data after a reconnection. This invokes fake `removed` messages on every document.\n\t * @param {number} [options.maxTimeout=undefined] - Maximum wait for a response from the server to the method call. Default no maxTimeout.\n\t * @param {Array} [plugins] - Array of plugins.\n\t * @return {simpleDDP} - A new simpleDDP instance.\n\t * @example\n\t * var opts = {\n\t *    endpoint: \"ws://someserver.com/websocket\",\n\t *    SocketConstructor: WebSocket,\n\t *    reconnectInterval: 5000\n\t * };\n\t * var server = new simpleDDP(opts);\n\t */\n\tconstructor(opts,plugins) {\n\t\tthis._id = simpleDDPcounter();\n\t\tthis._opGenId = uniqueIdFuncGen();\n\t\tthis._opts = opts;\n\t\tthis.ddpConnection = new DDP(opts);\n\t\tthis.subs = [];\n\n\t\t/**\n\t\t\tAll collections data recieved from server.\n\n\t\t\t@type Object\n\t\t*/\n\t\tthis.collections = {};\n\n\t\tthis.onChangeFuncs = [];\n\n\t\t/**\n\t\t\tWhether the client is connected to server.\n\n\t\t\t@type Boolean\n\t\t*/\n\t\tthis.connected = false;\n\n\t\tthis.maxTimeout = opts.maxTimeout;\n\t\tthis.clearDataOnReconnection = opts.clearDataOnReconnection === undefined ? true : opts.clearDataOnReconnection;\n\t\tthis.tryingToConnect = opts.autoConnect === undefined ? true : opts.autoConnect;\n\t\tthis.tryingToDisconnect = false;\n\t\tthis.willTryToReconnect = opts.autoReconnect === undefined ? true : opts.autoReconnect;\n\n\t\tlet pluginConnector = connectPlugins.bind(this,plugins);\n\n\t\t// plugin init section\n\t\tpluginConnector('init','beforeConnected');\n\n\t\tthis.connectedEvent = this.on('connected',(m)=>{\n\t\t\tthis.connected = true;\n\t\t\tthis.tryingToConnect = false;\n\t\t});\n\n\t\tpluginConnector('afterConnected', 'beforeSubsRestart');\n\n\t\tthis.connectedEventRestartSubs = this.on('connected', (m)=>{\n\t\t\tif (this.clearDataOnReconnection) {\n\t\t\t\t// we have to clean local collections\n\t\t\t\tthis.clearData().then(()=>{\n\t\t\t\t\tthis.ddpConnection.emit('clientReady');\n\t\t\t\t\tthis.restartSubs();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.ddpConnection.emit('clientReady');\n\t\t\t\tthis.restartSubs();\n\t\t\t}\n\t\t});\n\n\t\tpluginConnector('afterSubsRestart','beforeDisconnected');\n\n\t\tthis.disconnectedEvent = this.on('disconnected',(m)=>{\n\t\t\tthis.connected = false;\n\t\t\tthis.tryingToDisconnect = false;\n\t\t\tthis.tryingToConnect = this.willTryToReconnect;\n\t\t});\n\n\t\tpluginConnector('afterDisconnected','beforeAdded');\n\n\t\tthis.addedEvent = this.on('added',(m) => this.dispatchAdded(m));\n\t\tpluginConnector('afterAdded','beforeChanged');\n\t\tthis.changedEvent = this.on('changed',(m) => this.dispatchChanged(m));\n\t\tpluginConnector('afterChanged','beforeRemoved');\n\t\tthis.removedEvent = this.on('removed',(m) => this.dispatchRemoved(m));\n\t\tpluginConnector('afterRemoved','after');\n\t}\n\n\t/**\n\t * Restarts all subs.\n\t * @private\n\t */\n\trestartSubs() {\n\t\tthis.subs.forEach((sub)=>{\n\t\t\tif (sub.isOn()) {\n\t\t\t\tsub.restart();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Use this for fetching the subscribed data and for reactivity inside the collection.\n\t * @public\n\t * @param {string} name - Collection name.\n\t * @return {ddpCollection}\n\t */\n\tcollection(name) {\n\t\treturn new ddpCollection(name,this);\n\t}\n\n\t/**\n\t * Dispatcher for ddp added messages.\n\t * @private\n\t * @param {Object} m - DDP message.\n\t */\n\tdispatchAdded(m) {\n\t\t//m везде одинаковое, стоит наверное копировать\n\t\tif (this.collections.hasOwnProperty(m.collection)) {\n\t\t\tlet i = this.collections[m.collection].findIndex((obj)=>{\n\t\t\t\treturn obj.id == m.id;\n\t\t\t});\n\t\t\tif (i>-1) {\n\t\t\t\t// new sub knows nothing about old sub\n\t\t\t\tthis.collections[m.collection].splice(i,1);\n\t\t\t}\n\t\t}\n\t\tif (!this.collections.hasOwnProperty(m.collection)) this.collections[m.collection] = [];\n\t\tlet newObj = Object.assign({id:m.id},m.fields);\n\t\tlet i = this.collections[m.collection].push(newObj);\n\t\tlet fields = {};\n\t\tif (m.fields) {\n\t\t\tObject.keys(m.fields).map((p)=>{\n\t\t\t\tfields[p] = 1;\n\t\t\t});\n\t\t}\n\t\tthis.onChangeFuncs.forEach((l)=>{\n\t\t\tif (l.collection==m.collection) {\n\t\t\t\tlet hasFilter = l.hasOwnProperty('filter');\n\t\t\t\tlet newObjFullCopy = fullCopy(newObj);\n\t\t\t\tif (!hasFilter) {\n\t\t\t\t\tl.f({changed:false,added:newObjFullCopy,removed:false});\n\t\t\t\t} else if (hasFilter && l.filter(newObjFullCopy,i-1,this.collections[m.collection])) {\n\t\t\t\t\tl.f({prev:false,next:newObjFullCopy,fields,fieldsChanged:newObjFullCopy,fieldsRemoved:[]});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Dispatcher for ddp changed messages.\n\t * @private\n\t * @param {Object} m - DDP message.\n\t */\n\tdispatchChanged(m) {\n\t\tif (!this.collections.hasOwnProperty(m.collection)) this.collections[m.collection] = [];\n\t\tlet i = this.collections[m.collection].findIndex((obj)=>{\n\t\t\treturn obj.id == m.id;\n\t\t});\n\t\tif (i>-1) {\n\t\t\tlet prev = fullCopy(this.collections[m.collection][i]);\n\t\t\tlet fields = {}, fieldsChanged = {}, fieldsRemoved = [];\n\t\t\tif (m.fields) {\n\t\t\t\tfieldsChanged = m.fields;\n\t\t\t\tObject.keys(m.fields).map((p)=>{\n\t\t\t\t\tfields[p] = 1;\n\t\t\t\t});\n\t\t\t\tObject.assign(this.collections[m.collection][i],m.fields);\n\t\t\t}\n\t\t\tif (m.cleared) {\n\t\t\t\tfieldsRemoved = m.cleared;\n\t\t\t\tm.cleared.forEach((fieldName)=>{\n\t\t\t\t\tfields[fieldName] = 0;\n\t\t\t\t\tdelete this.collections[m.collection][i][fieldName];\n\t\t\t\t});\n\t\t\t}\n\t\t\tlet next = this.collections[m.collection][i];\n\t\t\tthis.onChangeFuncs.forEach((l)=>{\n\t\t\t\tif (l.collection==m.collection) {\n\t\t\t\t\t// perhaps add a parameter inside l object to choose if full copy should occur\n\t\t\t\t\tlet hasFilter = l.hasOwnProperty('filter');\n\t\t\t\t\tif (!hasFilter) {\n\t\t\t\t\t\tl.f({changed:{prev,next:fullCopy(next),fields,fieldsChanged,fieldsRemoved},added:false,removed:false});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet fCopyNext = fullCopy(next);\n\t\t\t\t\t\tlet prevFilter = l.filter(prev,i,this.collections[m.collection]);\n\t\t\t\t\t\tlet nextFilter = l.filter(fCopyNext,i,this.collections[m.collection]);\n\t\t\t\t\t\tif (prevFilter || nextFilter) {\n\t\t\t\t\t\t\tl.f({prev,next:fCopyNext,fields,fieldsChanged,fieldsRemoved,predicatePassed:[prevFilter,nextFilter]});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tthis.dispatchAdded(m);\n\t\t}\n\t}\n\n\t/**\n\t * Dispatcher for ddp removed messages.\n\t * @private\n\t * @param {Object} m - DDP message.\n\t */\n\tdispatchRemoved(m) {\n\t\tif (!this.collections.hasOwnProperty(m.collection)) this.collections[m.collection] = [];\n\t\tlet i = this.collections[m.collection].findIndex((obj)=>{\n\t\t\treturn obj.id == m.id;\n\t\t});\n\t\tif (i>-1) {\n\t\t\tlet prevProps;\n\t\t\tlet removedObj = this.collections[m.collection].splice(i,1)[0];\n\t\t\tthis.onChangeFuncs.forEach((l)=>{\n\t\t\t\tif (l.collection==m.collection) {\n\t\t\t\t\tlet hasFilter = l.hasOwnProperty('filter');\n\t\t\t\t\tif (!hasFilter) {\n\t\t\t\t\t\t// возможно стоит сделать fullCopy, чтобы было как в случае dispatchAdded и dispatchChanged\n\t\t\t\t\t\tl.f({changed:false,added:false,removed:removedObj});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (l.filter(removedObj,i,this.collections[m.collection])) {\n\t\t\t\t\t\t\tl.f({prev:removedObj,next:false});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Connects to the ddp server. The method is called automatically by the class constructor if the autoConnect option is set to true (default behavior).\n\t * @public\n\t * @return {Promise} - Promise which resolves when connection is established.\n\t */\n\tconnect() {\n\t\tthis.willTryToReconnect = this._opts.autoReconnect === undefined ? true : this._opts.autoReconnect;\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (!this.tryingToConnect) {\n\t\t\t\tthis.ddpConnection.connect();\n\t\t\t\tthis.tryingToConnect = true;\n\t\t\t}\n\t\t\tif (!this.connected) {\n\t\t\t\tlet stoppingInterval;\n\n\t\t\t\tlet connectionHandler = this.on('connected', () => {\n\t\t\t\t\tclearTimeout(stoppingInterval);\n\t\t\t\t\tconnectionHandler.stop();\n\t\t\t\t\tthis.tryingToConnect = false;\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\n\t\t\t\tif (this.maxTimeout) {\n\t\t\t\t\tstoppingInterval = setTimeout(()=>{\n\t\t\t\t\t\tconnectionHandler.stop();\n\t\t\t\t\t\tthis.tryingToConnect = false;\n\t\t\t\t\t\treject(new Error('MAX_TIMEOUT_REACHED'));\n\t\t\t\t\t},this.maxTimeout);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Disconnects from the ddp server by closing the WebSocket connection. You can listen on the disconnected event to be notified of the disconnection.\n\t * @public\n\t * @return {Promise} - Promise which resolves when connection is closed.\n\t */\n\tdisconnect() {\n\t\tthis.willTryToReconnect = false;\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (!this.tryingToDisconnect) {\n\t\t\t\tthis.ddpConnection.disconnect();\n\t\t\t\tthis.tryingToDisconnect = true;\n\t\t\t}\n\t\t\tif (this.connected) {\n\t\t\t\tlet connectionHandler = this.on('disconnected', () => {\n\t\t\t\t\tconnectionHandler.stop();\n\t\t\t\t\tthis.tryingToDisconnect = false;\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Calls a remote method with arguments passed in array.\n\t * @public\n\t * @param {string} method - Name of the server publication.\n\t * @param {Array} [arguments] - Array of parameters to pass to the remote method. Pass an empty array or don't pass anything if you do not wish to pass any parameters.\n\t * @param {boolean} [atBeginning=false] - If true puts method call at the beginning of the requests queue.\n\t * @return {Promise} - Promise object, which resolves when receives a result send by server and rejects when receives an error send by server.\n\t * @example\n\t * server.apply(\"method1\").then(function(result) {\n\t *\tconsole.log(result); //show result message in console\n\t *    if (result.someId) {\n\t *        //server sends us someId, lets call next method using this id\n\t *        return server.apply(\"method2\",[result.someId]);\n\t *    } else {\n\t *        //we didn't recieve an id, lets throw an error\n\t *        throw \"no id sent\";\n\t *    }\n\t * }).then(function(result) {\n\t *    console.log(result); //show result message from second method\n\t * }).catch(function(error) {\n\t *    console.log(result); //show error message in console\n\t * });\n\t */\n\tapply(method,args,atBeginning = false) {\n\t  return new Promise((resolve, reject) => {\n\t\t\tconst methodId = this.ddpConnection.method(method,args?args:[],atBeginning);\n\t\t\tconst _self = this;\n\n\t\t\tlet stoppingInterval;\n\n\t\t\tfunction onMethodResult (message) {\n\t\t\t\tif (message.id == methodId) {\n\t\t\t\t\tclearTimeout(stoppingInterval);\n\t\t\t\t\tif (!message.error) {\n\t\t\t\t\t\tresolve(message.result);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(message.error);\n\t\t\t\t\t}\n\t\t\t\t\t_self.ddpConnection.removeListener('result', onMethodResult);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.ddpConnection.on(\"result\", onMethodResult);\n\n\t\t\tif (this.maxTimeout) {\n\t\t\t\tstoppingInterval = setTimeout(()=>{\n\t\t\t\t\tthis.ddpConnection.removeListener('result', onMethodResult);\n\t\t\t\t\treject(new Error('MAX_TIMEOUT_REACHED'));\n\t\t\t\t},this.maxTimeout);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Calls a remote method with arguments passed after the first argument.\n\t * Syntactic sugar for @see apply.\n\t * @public\n\t * @param {string} method - Name of the server publication.\n\t * @param {...any} [args] - List of parameters to pass to the remote method. Parameters are passed as function arguments.\n\t * @return {Promise} - Promise object, which resolves when receives a result send by server and rejects when receives an error send by server.\n\t */\n\tcall(method,...args) {\n\t  return this.apply(method,args);\n\t}\n\n\t/**\n\t * Tries to subscribe to a specific publication on server.\n\t * Starts the subscription if the same subscription exists.\n\t * @public\n\t * @param {string} pubname - Name of the publication on server.\n\t * @param {Array} [arguments] - Array of parameters to pass to the remote method. Pass an empty array or don't pass anything if you do not wish to pass any parameters.\n\t * @return {ddpSubscription} - Subscription.\n\t */\n\tsub(pubname,args) {\n\t\tlet hasSuchSub = this.subs.find((sub) => {\n\t\t\treturn sub.pubname == pubname && isEqual(sub.args,Array.isArray(args)?args:[]);\n\t\t});\n\t\tif (!hasSuchSub) {\n\t\t\tlet i = this.subs.push(new ddpSubscription(pubname,Array.isArray(args)?args:[],this));\n\t\t\treturn this.subs[i-1];\n\t\t} else {\n\t\t\tif (hasSuchSub.isStopped()) hasSuchSub.start();\n\t\t\treturn hasSuchSub;\n\t\t}\n\t}\n\n\t/**\n\t * Tries to subscribe to a specific publication on server.\n\t * Syntactic sugar for @see sub.\n\t * @public\n\t * @param {string} pubname - Name of the publication on server.\n\t * @param {...any} [args] - List of parameters to pass to the remote method. Parameters are passed as function arguments.\n\t * @return {ddpSubscription} - Subscription.\n\t */\n\tsubscribe(pubname, ...args) {\n\t\treturn this.sub(pubname, args);\n\t}\n\n\t/**\n\t * Starts listening server for basic DDP event running f each time the message arrives.\n\t * @public\n\t * @param {string} event - Any event name from DDP specification.\n\t * Default suppoted events: `connected`, `disconnected`, `added`, `changed`, `removed`, `ready`, `nosub`, `error`, `ping`, `pong`.\n\t * @param {Function} f - Function which receives a message from a DDP server as a first argument each time server is invoking event.\n\t * @return {ddpEventListener}\n\t * @example\n\t * server.on('connected', () => {\n\t *     // you can show a success message here\n\t * });\n\t *\n\t * server.on('disconnected', () => {\n\t *     // you can show a reconnection message here\n\t * });\n\t */\n\ton(event,f) {\n\t\treturn new ddpEventListener(event,f,this);\n\t}\n\n\t/**\n\t * Stops all reactivity.\n\t */\n\tstopChangeListeners() {\n\t\tthis.onChangeFuncs = [];\n\t}\n\n\t/**\n\t * Removes all documents like if it was removed by the server publication.\n\t * @public\n\t * @return {Promise} - Resolves when data is successfully removed.\n\t */\n\tclearData() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tlet totalDocuments = 0;\n\t\t\tObject.keys(this.collections).forEach((collection)=>{\n\t\t\t\ttotalDocuments += Array.isArray(this.collections[collection]) ? this.collections[collection].length : 0;\n\t\t\t});\n\n\t\t\tif (totalDocuments === 0) {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\tlet counter = 0;\n\t\t\t\tlet uniqueId = this._id+\"-\"+this._opGenId();\n\n\t\t\t\tconst listener = this.on('removed',(m,id)=>{\n\t\t\t\t\tif (id == uniqueId) {\n\t\t\t\t\t\tcounter++;\n\t\t\t\t\t\tif (counter==totalDocuments) {\n\t\t\t\t\t\t\tlistener.stop();\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tObject.keys(this.collections).forEach((collection)=>{\n\t\t\t\t\tthis.collections[collection].forEach((doc)=>{\n\t\t\t\t\t\tthis.ddpConnection.emit('removed',{\n\t\t\t\t\t\t\tmsg: 'removed',\n\t\t\t\t\t\t\tid: doc.id,\n\t\t\t\t\t\t\tcollection: collection\n\t\t\t\t\t\t}, uniqueId);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Imports the data like if it was published by the server.\n\t * @public\n\t * @param {Object|string} data - ESJON string or EJSON.\n\t * @return {Promise} - Resolves when data is successfully imported.\n\t */\n\timportData(data) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tlet c = typeof data === 'string' ? EJSON.parse(data) : data;\n\n\t\t\tlet totalDocuments = 0;\n\t\t\tObject.keys(c).forEach((collection)=>{\n\t\t\t\ttotalDocuments += Array.isArray(c[collection]) ? c[collection].length : 0;\n\t\t\t});\n\n\t\t\tlet counter = 0;\n\t\t\tlet uniqueId = this._id+\"-\"+this._opGenId();\n\n\t\t\tconst listener = this.on('added',(m,id)=>{\n\t\t\t\tif (id == uniqueId) {\n\t\t\t\t\tcounter++;\n\t\t\t\t\tif (counter==totalDocuments) {\n\t\t\t\t\t\tlistener.stop();\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tObject.keys(c).forEach((collection)=>{\n\t\t\t\tc[collection].forEach((doc)=>{\n\n\t\t\t\t\tlet docFields = Object.assign({},doc);\n\t\t\t\t\tdelete docFields['id'];\n\n\t\t\t\t\tthis.ddpConnection.emit('added',{\n\t\t\t\t\t\tmsg: 'added',\n\t\t\t\t\t\tid: doc.id,\n\t\t\t\t\t\tcollection: collection,\n\t\t\t\t\t\tfields: docFields\n\t\t\t\t\t}, uniqueId);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Exports the data\n\t * @public\n\t * @param {string} [format='string'] - Possible values are 'string' (EJSON string) and 'raw' (EJSON).\n\t * @return {Object|string} - EJSON string or EJSON.\n\t */\n\texportData(format) {\n\t\tif (format === undefined || format == 'string') {\n\t\t\treturn EJSON.stringify(this.collections);\n\t\t} else if (format == 'raw') {\n\t\t\treturn fullCopy(this.collections);\n\t\t}\n\t}\n\n\t/**\n\t * Marks every passed @see ddpSubscription object as ready like if it was done by the server publication.\n\t * @public\n\t * @param {Array} subs - Array of @see ddpSubscription objects.\n\t * @return {Promise} - Resolves when all passed subscriptions are marked as ready.\n\t */\n\tmarkAsReady(subs) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tlet uniqueId = this._id+\"-\"+this._opGenId();\n\n\t\t\tthis.ddpConnection.emit('ready',{\n\t\t\t\tmsg: 'ready',\n\t\t\t\tsubs: subs.map(sub=>sub._getId())\n\t\t\t}, uniqueId);\n\n\t\t\tconst listener = this.on('ready',(m,id)=>{\n\t\t\t\tif (id == uniqueId) {\n\t\t\t\t\tlistener.stop();\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n}\n\nexport default simpleDDP;\n"
  },
  {
    "path": "test/test_call.js",
    "content": "const assert = require('chai').assert;\n\nconst simpleDDP = require('../lib/simpleddp');\nconst ws = require(\"ws\");\n\nconst opts = {\n    endpoint: \"ws://someserver.com/websocket\",\n    SocketConstructor: ws,\n    reconnectInterval: 5000,\n    maxTimeout: 25\n};\n\ndescribe('simpleDDP', function(){\n  let server = new simpleDDP(opts);\n\n  describe('#call', function (){\n\n    it('should return promise and afterwards then function should run', function (done) {\n\n      server.call(\"somemethod\").then(function() {\n        done();\n      });\n\n      server.ddpConnection.emit('result',{\n        msg: 'result',\n        id: '0',\n        result: 'ok'\n      });\n\n    });\n\n  });\n\n  describe('#apply', function (){\n\n    it('should return promise and afterwards then function should run', function (done) {\n\n      server.apply(\"somemethod\").then(function () {\n        done();\n      });\n\n      server.ddpConnection.emit('result', {\n        msg: 'result',\n        id: '1',\n        result: 'ok'\n      });\n\n    });\n\n    it(\"a rejection should be fire if the max timeout has been exceeded\", function (done) {\n      this.timeout(100);\n\n      server.apply(\"somemethod\").then(function () {\n        assert.fail();\n      }).catch(function (error) {\n        assert.isNotNull(error)\n        done();\n      });\n\n      const ddpConnection = server.ddpConnection;\n\n      setTimeout(function () {\n        ddpConnection.emit(\"result\", {\n          msg: \"result\",\n          id: \"1\",\n          result: \"ok\"\n        });\n      }, 50);\n    });\n\n  });\n\n  after(function() {\n    // runs after all tests in this block\n    server.disconnect();\n    server = null;\n  });\n});\n"
  },
  {
    "path": "test/test_collectionfetch.js",
    "content": "const assert = require('chai').assert;\n\nconst simpleDDP = require('../lib/simpleddp');\nconst ws = require(\"ws\");\n\nconst opts = {\n    endpoint: \"ws://someserver.com/websocket\",\n    SocketConstructor: ws,\n    reconnectInterval: 5000\n};\n\ndescribe('simpleDDP', function(){\n  let server = new simpleDDP(opts);\n\n  describe('#collection->fetch', function (){\n\n    beforeEach(function() {\n      // runs before each test in this block\n      // turn the default collection to the initial state\n      server.collections['foe'] = [{\n        id: 'abc',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'def',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      },{\n        id: 'ghi',\n        name: 'unusual',\n        why: 'because'\n      }];\n\n      //remove onChange handlers\n      server.onChangeFuncs = [];\n    });\n\n    it('should return filtered collection', function () {\n\n      let collectionCut = server.collection('foe').filter((e,i,c)=>{\n        return e.id == 'abc' || e.quality;\n      }).fetch();\n\n      assert.deepEqual(collectionCut,[{\n        id: 'abc',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'def',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      }]);\n\n    });\n\n    it('should return [] because no such collection', function () {\n\n      let collectionCut = server.collection('abc').fetch();\n\n      assert.deepEqual(collectionCut,[]);\n\n    });\n\n    it('should return [] because no such collection', function () {\n\n      let collectionCut = server.collection('abc').filter((e,i,c)=>{\n        return e.id == 'abc' || e.quality;\n      }).fetch();\n\n      assert.deepEqual(collectionCut,[]);\n\n    });\n\n  });\n\n  after(function() {\n    // runs after all tests in this block\n    server.disconnect();\n    server = null;\n  });\n});\n"
  },
  {
    "path": "test/test_importexport.js",
    "content": "const assert = require('chai').assert;\n\nconst simpleDDP = require('../lib/simpleddp');\nconst ws = require(\"ws\");\nconst EJSON = require(\"ejson\");\n\nconst opts = {\n    endpoint: \"ws://someserver.com/websocket\",\n    SocketConstructor: ws,\n    reconnectInterval: 5000\n};\n\nlet onListener = null;\n\ndescribe('simpleDDP', function(){\n  let server = new simpleDDP(opts);\n\n  describe('#collection->importData', function (){\n\n    beforeEach(function() {\n      // runs before each test in this block\n      // turn the default collection to the initial state\n      server.collections = {};\n\n    });\n\n    it('should import raw data into storage', function (done) {\n\n      let data = {\n        foe: [{\n          id: 'abc',\n          cat: 'a',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        }],\n        bar: [{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        }]\n      };\n\n      server.importData(data).then(function() {\n        assert.deepEqual(server.collections,data);\n        done();\n      });\n    });\n\n    it('should import string data into storage', function (done) {\n\n      let dataRaw = {\n        foe: [{\n          id: 'abc',\n          cat: 'a',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        }],\n        bar: [{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        }]\n      };\n\n      dataJSON = EJSON.stringify(dataRaw);\n\n      server.importData(dataJSON).then(function() {\n        assert.deepEqual(server.collections,dataRaw);\n        done();\n      });\n\n    });\n\n  });\n\n  describe('#collection->exportData', function (){\n\n    const data = {\n      foe: [{\n        id: 'abc',\n        cat: 'a',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'def',\n        cat: 'a',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      }],\n      bar: [{\n        id: 'ghi',\n        cat: 'b',\n        name: 'victory',\n        why: 'because'\n      },{\n        id: 'plu',\n        cat: 'a',\n        name: 'unusual',\n        why: 'because'\n      }]\n    };\n\n    before(function() {\n      server.collections = data;\n\n    });\n\n    it('should export raw data from the storage', function () {\n\n      let exported = server.exportData('raw');\n\n      assert.deepEqual(exported,data);\n\n    });\n\n    it('should export EJSON data from the storage', function () {\n\n      let exported = EJSON.parse(server.exportData());\n\n      assert.deepEqual(exported,data);\n\n    });\n\n  });\n\n  describe('#collection->markAsReady', function (){\n    let emulSub;\n\n    after(function() {\n      // runs after every test in this block\n      emulSub.stop();\n      emulSub = undefined;\n    });\n\n    it('should emulate subscription readiness', function (done) {\n\n      emulSub = server.sub('testsub');\n      emulSub.ready().then(done);\n      server.markAsReady([emulSub]);\n\n    });\n\n  });\n\n  describe('#collection->clearData', function (){\n\n    const data = {\n      foe: [{\n        id: 'abc',\n        cat: 'a',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'def',\n        cat: 'a',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      }],\n      bar: [{\n        id: 'ghi',\n        cat: 'b',\n        name: 'victory',\n        why: 'because'\n      },{\n        id: 'plu',\n        cat: 'a',\n        name: 'unusual',\n        why: 'because'\n      }]\n    };\n\n    after(function() {\n      //server.collections = {};\n    });\n\n    it('should clear all collections data', function (done) {\n\n      server.importData(data).then(function () {\n        assert.deepEqual(server.collections,data);\n        server.clearData().then(function() {\n          assert.deepEqual(server.collections,{ foe: [], bar: [] });\n          done();\n        });\n      });\n\n    });\n\n  });\n\n  after(function() {\n    // runs after all tests in this block\n    server.disconnect();\n    server = null;\n  });\n});\n"
  },
  {
    "path": "test/test_onchange.js",
    "content": "const assert = require('chai').assert;\n\nconst simpleDDP = require('../lib/simpleddp');\nconst ws = require(\"ws\");\n\nconst opts = {\n    endpoint: \"ws://someserver.com/websocket\",\n    SocketConstructor: ws,\n    reconnectInterval: 5000\n};\n\ndescribe('simpleDDP', function(){\n  let server = new simpleDDP(opts);\n\n  describe('#onChange', function (){\n    beforeEach(function() {\n      // runs before each test in this block\n      // turn the default collection to the initial state\n      server.collections['foe'] = [{\n        id: 'abc',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'def',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      },{\n        id: 'ghi',\n        name: 'unusual',\n        why: 'because'\n      }];\n\n      //remove onChange handlers\n      server.onChangeFuncs = [];\n    });\n\n    it('should detect adding doc to the collection', function (done) {\n\n      server.collection('foe').onChange(function ({added,removed,changed}) {\n        assert.deepEqual(added, {id: 'nby', name:'new boy', age:'1 minute'});\n        done();\n      });\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'nby',\n        fields: {name:'new boy', age:'1 minute'},\n        collection: 'foe'\n      });\n\n    });\n\n    it('should detect changing doc in the collection', function (done) {\n\n      server.collection('foe').onChange(function ({added,removed,changed}) {\n        assert.deepEqual(changed, {\n          prev: {\n            id: 'abc',\n            name: 'test',\n            age: '1 month',\n            quality: 'super'\n          },\n          next: {\n            id: 'abc',\n            name: 'new boy',\n            quality: 'medium'\n          },\n          fields: {\n            name: 1,\n            quality: 1,\n            age: 0\n          },\n          fieldsChanged: {\n            name: 'new boy',\n            quality: 'medium'\n          },\n          fieldsRemoved: ['age']\n        });\n        done();\n      });\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'abc',\n        fields: {name:'new boy', quality:'medium'},\n        cleared: ['age'],\n        collection: 'foe'\n      });\n\n    });\n\n    it('should detect removing doc from the collection', function (done) {\n\n      server.collection('foe').onChange(function ({added,removed,changed}) {\n        assert.deepEqual(removed, {\n          id: 'abc',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        });\n        done();\n      });\n\n      server.ddpConnection.emit('removed',{\n        msg: 'removed',\n        id: 'abc',\n        collection: 'foe'\n      });\n\n    });\n\n    it('should detect changing the doc', function (done) {\n\n      server.collection('foe').filter((e,i,c)=>i==0).onChange(function (st) {\n        assert.deepEqual(st, {\n          prev: {\n            id: 'abc',\n            name: 'test',\n            age: '1 month',\n            quality: 'super'\n          },\n          next: {\n            id: 'abc',\n            name: 'new boy',\n            quality: 'medium'\n          },\n          fields: {\n            name: 1,\n            quality: 1,\n            age: 0\n          },\n          fieldsChanged: {\n            name: 'new boy',\n            quality: 'medium'\n          },\n          fieldsRemoved: ['age'],\n          predicatePassed: [true,true]\n        });\n        done();\n      });\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'abc',\n        fields: {name:'new boy', quality:'medium'},\n        cleared: ['age'],\n        collection: 'foe'\n      });\n\n    });\n\n    it('should detect removing the doc', function (done) {\n\n      server.collection('foe').filter((e,i,c)=>i==0).onChange(function ({prev,next,fields,fieldsChanged,fieldsRemoved}) {\n        assert.deepEqual(prev, {\n          id: 'abc',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        });\n        assert.isNotOk(next);\n        done();\n      });\n\n      server.ddpConnection.emit('removed',{\n        msg: 'removed',\n        id: 'abc',\n        collection: 'foe'\n      });\n\n    });\n\n    it('should detect changing the doc\\'s properties', function (done) {\n\n      server.collection('foe').filter((e,i,c)=>i==0).onChange(function (st) {\n        if ('name' in st.fields) {\n          assert.strictEqual(st.prev.name, 'test');\n          assert.strictEqual(st.next.name, 'new boy');\n          done();\n        }\n      });\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'abc',\n        fields: {name:'new boy', quality:'medium'},\n        cleared: ['age'],\n        collection: 'foe'\n      });\n\n    });\n\n    it('should NOT detect changing other doc\\'s properties', function (done) {\n\n      server.collection('foe').filter((e,i,c)=>i==0).onChange(function ({fields}) {\n        if ('name' in fields) {\n          done(new Error());\n        }\n      });\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'abc',\n        fields: {quality:'medium'},\n        cleared: ['age'],\n        collection: 'foe'\n      });\n\n      setTimeout(done, 10);\n\n    });\n\n    it('should NOT detect changing doc\\'s properties because stopped and then should detect after rerun', function (done) {\n\n      let trg = true;\n\n      let handler = server.collection('foe').filter((e,i,c)=>i==0).onChange(function ({prev,next}) {\n        if (trg) {\n          done(new Error());\n        } else if (prev.quality=='medium' && next.quality=='normal') {\n          done();\n        }\n      });\n\n      handler.stop();\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'abc',\n        fields: {quality:'medium'},\n        cleared: ['age'],\n        collection: 'foe'\n      });\n      setTimeout(()=>{\n        trg = false;\n        handler.start();\n        server.ddpConnection.emit('changed',{\n          msg: 'changed',\n          id: 'abc',\n          fields: {quality:'normal'},\n          cleared: [],\n          collection: 'foe'\n        });\n      },10);\n    });\n\n  });\n\n  after(function() {\n    // runs after all tests in this block\n    server.disconnect();\n    server = null;\n  });\n});\n"
  },
  {
    "path": "test/test_reactive.js",
    "content": "const assert = require('chai').assert;\n\nconst simpleDDP = require('../lib/simpleddp');\nconst ws = require(\"ws\");\n\nconst opts = {\n    endpoint: \"ws://someserver.com/websocket\",\n    SocketConstructor: ws,\n    reconnectInterval: 5000\n};\n\nlet onListener = null;\n\ndescribe('simpleDDP', function(){\n  let server = new simpleDDP(opts);\n\n  describe('#collection->reactive', function (){\n\n    beforeEach(function() {\n      // runs before each test in this block\n      // turn the default collection to the initial state\n      server.collections['foe'] = [{\n        id: 'abc',\n        cat: 'a',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'def',\n        cat: 'a',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      },{\n        id: 'ghi',\n        cat: 'b',\n        name: 'victory',\n        why: 'because'\n      },{\n        id: 'plu',\n        cat: 'a',\n        name: 'unusual',\n        why: 'because'\n      }];\n\n      //remove onChange handlers\n      server.onChangeFuncs = [];\n\n      //stop stop listeners\n      if (onListener) onListener.stop();\n    });\n\n    it('should return reactive filtered collection', function () {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      assert.deepEqual(collectionReactiveCut.data(),[{\n        id: 'abc',\n        cat: 'a',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'def',\n        cat: 'a',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      },{\n        id: 'plu',\n        cat: 'a',\n        name: 'unusual',\n        why: 'because'\n      }]);\n\n    });\n\n    it('should return sorted reactive filtered collection', function () {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      collectionReactiveCut.sort((a,b)=>{\n        if (a.name <= b.name) {\n          return -1;\n        } else {\n          return 1;\n        }\n      });\n\n      assert.deepEqual(collectionReactiveCut.data(),[{\n        id: 'def',\n        cat: 'a',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      },{\n        id: 'abc',\n        cat: 'a',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'plu',\n        cat: 'a',\n        name: 'unusual',\n        why: 'because'\n      }]);\n\n    });\n\n    it('should return sorted (sort via settings) reactive filtered collection', function () {\n\n      const sortFunction = (a,b)=>{\n        if (a.name <= b.name) {\n          return -1;\n        } else {\n          return 1;\n        }\n      };\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive({sort:sortFunction});\n\n      assert.deepEqual(collectionReactiveCut.data(),[{\n        id: 'def',\n        cat: 'a',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      },{\n        id: 'abc',\n        cat: 'a',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'plu',\n        cat: 'a',\n        name: 'unusual',\n        why: 'because'\n      }]);\n\n    });\n\n    it('should reactively remove element from filtered collection cut when element changes', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      let collectionLength1 = collectionReactiveCut.data().length;\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'abc',\n        fields: {cat:'b'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        let collectionLength2 = collectionReactiveCut.data().length;\n        assert.equal(collectionLength1,3);\n        assert.equal(collectionLength2,2);\n        done();\n      },10);\n\n    });\n\n    it('should reactively remove element from filtered collection cut when element is removed', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      let collectionLength1 = collectionReactiveCut.data().length;\n\n      server.ddpConnection.emit('removed',{\n        msg: 'removed',\n        id: 'abc',\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        let collectionLength2 = collectionReactiveCut.data().length;\n        assert.equal(collectionLength1,3);\n        assert.equal(collectionLength2,2);\n        done();\n      },10);\n\n    });\n\n    it('should reactively add element to filtered collection cut when element changes', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      let collectionLength1 = collectionReactiveCut.data().length;\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'ghi',\n        fields: {cat:'a'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        let collectionLength2 = collectionReactiveCut.data().length;\n        assert.equal(collectionLength1,3);\n        assert.equal(collectionLength2,4);\n        done();\n      },10);\n\n    });\n\n    it('should reactively add element to filtered collection cut when element is added', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      let collectionLength1 = collectionReactiveCut.data().length;\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'a',name:'newElement'},\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        let collectionLength2 = collectionReactiveCut.data().length;\n        assert.equal(collectionLength1,3);\n        assert.equal(collectionLength2,4);\n        done();\n      },10);\n\n    });\n\n    it('should reactively re-sort filtered collection cut when element changes', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      collectionReactiveCut.sort((a,b)=>{\n        if (a.name <= b.name) {\n          return -1;\n        } else {\n          return 1;\n        }\n      });\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'abc',\n        fields: {name:'prime'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'abc',\n          cat: 'a',\n          name: 'prime',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        }]);\n        done();\n      },10);\n\n    });\n\n    it('should reactively re-sort filtered collection cut when element added to filtered cut by being changed', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      collectionReactiveCut.sort((a,b)=>{\n        if (a.name <= b.name) {\n          return -1;\n        } else {\n          return 1;\n        }\n      });\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'ghi',\n        fields: {cat:'a'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        },{\n          id: 'abc',\n          cat: 'a',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        },{\n          id: 'ghi',\n          cat: 'a',\n          name: 'victory',\n          why: 'because'\n        }]);\n        done();\n      },10);\n\n    });\n\n    it('should reactively re-sort filtered collection cut when element added to filtered cut by being added', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      collectionReactiveCut.sort((a,b)=>{\n        if (a.name <= b.name) {\n          return -1;\n        } else {\n          return 1;\n        }\n      });\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'a', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        },{\n          id: 'new',\n          cat: 'a',\n          name: 'tast',\n        },{\n          id: 'abc',\n          cat: 'a',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        }]);\n        done();\n      },10);\n\n    });\n\n    it('should not add to reactive collection an object that does not pass the filter', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').filter(e=>e.cat=='a').reactive();\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'abc',\n          cat: 'a',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        }]);\n        done();\n      },10);\n\n    });\n\n    it('should add to reactive collection an object', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive();\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'abc',\n          cat: 'a',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        },{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        },{\n          id: 'new',\n          cat: 'b',\n          name: 'tast'\n        }]);\n        done();\n      },10);\n\n    });\n\n    it('should add to reactive collection an object and re-sort', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive();\n\n      collectionReactiveCut.sort((a,b)=>{\n        if (a.name <= b.name) {\n          return -1;\n        } else {\n          return 1;\n        }\n      });\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        },{\n          id: 'new',\n          cat: 'b',\n          name: 'tast'\n        },{\n          id: 'abc',\n          cat: 'a',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        },{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        }]);\n        done();\n      },10);\n\n    });\n\n    it('should return reactive collection slice based on skip', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive({skip:2});\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      onListener = server.on('added',function (m) {\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        },{\n          id: 'new',\n          cat: 'b',\n          name: 'tast'\n        }]);\n        done();\n      });\n    });\n\n    it('should return reactive collection slice based on skip (via skip method)', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive().skip(2);\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      onListener = server.on('added',function (m) {\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        },{\n          id: 'new',\n          cat: 'b',\n          name: 'tast'\n        }]);\n        done();\n      });\n    });\n\n    it('should return reactive collection slice based on limit', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive({limit:3});\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      onListener = server.on('added',function (m) {\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'abc',\n          cat: 'a',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        },{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        }]);\n        done();\n      });\n    });\n\n    it('should return reactive collection slice based on limit (via limit method)', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive().limit(3);\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      onListener = server.on('added',function (m) {\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'abc',\n          cat: 'a',\n          name: 'test',\n          age: '1 month',\n          quality: 'super'\n        },{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        },{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        }]);\n        done();\n      });\n    });\n\n    it('should return reactive collection slice based on skip and limit', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive({skip:2,limit:2});\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      onListener = server.on('added',function (m) {\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        }]);\n        done();\n      });\n    });\n\n    it('should return reactive collection slice based on skip and limit declared vis settings method', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive().settings({skip:2,limit:2});\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      onListener = server.on('added',function (m) {\n        assert.deepEqual(collectionReactiveCut.data(),[{\n          id: 'ghi',\n          cat: 'b',\n          name: 'victory',\n          why: 'because'\n        },{\n          id: 'plu',\n          cat: 'a',\n          name: 'unusual',\n          why: 'because'\n        }]);\n        done();\n      });\n    });\n\n    it('should reduce reactive collection slice with skip and limit to a string', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive({skip:2,limit:2});\n\n      let allnames = collectionReactiveCut.reduce((acc,obj)=>acc+obj.name,'');\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      onListener = server.on('added',function (m) {\n        assert.equal(allnames.data().result,'victoryunusual');\n        done();\n      });\n    });\n\n    it('should map reactive collection slice with skip and limit to an array of names', function (done) {\n\n      let collectionReactiveCut = server.collection('foe').reactive({skip:2,limit:2});\n\n      let allnames = collectionReactiveCut.map((val)=>val.name);\n\n      let tick_happened = false;\n\n      allnames.onChange(function (arr) {\n        tick_happened = true;\n      });\n\n      server.ddpConnection.emit('added',{\n        msg: 'added',\n        id: 'new',\n        fields: {cat:'b', name:'tast'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      onListener1 = server.on('added',function (m) {\n        assert.isTrue(tick_happened);\n        assert.deepEqual(allnames.data().result,['victory','unusual']);\n        onListener1.stop();\n        server.ddpConnection.emit('changed',{\n          msg: 'changed',\n          id: 'ghi',\n          fields: {name:'working'},\n          cleared: [],\n          collection: 'foe'\n        });\n      });\n\n      onListener = server.on('changed',function (m) {\n        assert.deepEqual(allnames.data().result,['working','unusual']);\n        done();\n      });\n    });\n\n  });\n\n  after(function() {\n    // runs after all tests in this block\n    server.disconnect();\n    server = null;\n  });\n});\n"
  },
  {
    "path": "test/test_reactiveone.js",
    "content": "const assert = require('chai').assert;\n\nconst simpleDDP = require('../lib/simpleddp');\nconst ws = require(\"ws\");\n\nconst opts = {\n    endpoint: \"ws://someserver.com/websocket\",\n    SocketConstructor: ws,\n    reconnectInterval: 5000\n};\n\ndescribe('simpleDDP', function(){\n  let server = new simpleDDP(opts);\n\n  describe('#collection->reactive->one', function (){\n\n    beforeEach(function() {\n      // runs before each test in this block\n      // turn the default collection to the initial state\n      server.collections['foe'] = [{\n        id: 'abc',\n        cat: 'a',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      },{\n        id: 'def',\n        cat: 'a',\n        name: 'striker',\n        age: '100 years',\n        quality: 'medium'\n      },{\n        id: 'ghi',\n        cat: 'b',\n        name: 'victory',\n        why: 'because'\n      },{\n        id: 'plu',\n        cat: 'a',\n        name: 'unusual',\n        why: 'because'\n      }];\n\n      //remove onChange handlers\n      server.onChangeFuncs = [];\n    });\n\n    it('should return reactive object from filtered collection', function () {\n\n      let collectionReactiveObj = server.collection('foe').filter(e=>e.cat=='a').reactive().one();\n\n      assert.deepEqual(collectionReactiveObj.data(),{\n        id: 'abc',\n        cat: 'a',\n        name: 'test',\n        age: '1 month',\n        quality: 'super'\n      });\n\n    });\n\n    it('should change reactive object data to another object because new object does not pass the filter', function (done) {\n\n      let collectionReactiveObj = server.collection('foe').filter(e=>e.cat=='a').reactive().one();\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'abc',\n        fields: {cat:'b'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        assert.deepEqual(collectionReactiveObj.data(),{\n          id: 'def',\n          cat: 'a',\n          name: 'striker',\n          age: '100 years',\n          quality: 'medium'\n        });\n        done();\n      },10);\n    });\n\n    it('should update the reactive object', function (done) {\n\n      let collectionReactiveObj = server.collection('foe').filter(e=>e.cat=='a').reactive().one();\n\n      server.ddpConnection.emit('changed',{\n        msg: 'changed',\n        id: 'abc',\n        fields: {name:'not test'},\n        cleared: [],\n        collection: 'foe'\n      });\n\n      setTimeout(()=>{\n        assert.deepEqual(collectionReactiveObj.data(),{\n          id: 'abc',\n          cat: 'a',\n          name: 'not test',\n          age: '1 month',\n          quality: 'super'\n        });\n        done();\n      },10);\n    });\n\n\n  });\n\n  after(function() {\n    // runs after all tests in this block\n    server.disconnect();\n    server = null;\n  });\n});\n"
  },
  {
    "path": "test/test_sub.js",
    "content": "const assert = require('chai').assert;\n\nconst simpleDDP = require('../lib/simpleddp');\nconst ws = require(\"ws\");\n\nconst opts = {\n    endpoint: \"ws://someserver.com/websocket\",\n    SocketConstructor: ws,\n    reconnectInterval: 5000,\n    clearDataOnReconnection: true\n};\n\ndescribe('simpleDDP', function(){\n  let server = new simpleDDP(opts);\n\n  describe('#sub', function (){\n\n    it('should subscribe and simpleDDP.collections should update', async function () {\n\n      let subscriptionId = \"\";\n\n      setTimeout(function(){\n        server.ddpConnection.emit('added',{\n          msg: 'added',\n          collection: \"test\",\n          id: '0',\n          fields: {isOk:true}\n        });\n\n        server.ddpConnection.emit('ready',{\n          msg: 'ready',\n          subs: [subscriptionId]\n        });\n      },10);\n\n      let sub = server.sub(\"testsub\");\n      subscriptionId = sub.subscriptionId;\n\n      await sub.ready();\n\n      console.log('sub', sub.isReady())\n\n      assert.deepEqual(server.collections['test'][0],{\n        id: '0',\n        isOk: true\n      });\n\n    });\n\n    it('should subscribe and simpleDDP.collections should update, await sub ready should work both times', async function () {\n\n      let subscriptionId = \"\";\n\n      setTimeout(function(){\n        server.ddpConnection.emit('added',{\n          msg: 'changed',\n          collection: \"test\",\n          id: '0',\n          fields: {isOk:false}\n        });\n\n        server.ddpConnection.emit('ready',{\n          msg: 'ready',\n          subs: [subscriptionId]\n        });\n      },10);\n\n      let sub = server.sub(\"testsub\");\n      subscriptionId = sub.subscriptionId;\n\n      await sub.ready();\n\n      assert.deepEqual(server.collections['test'][0],{\n        id: '0',\n        isOk: true\n      });\n\n      await sub.ready();\n\n      assert.deepEqual(server.collections['test'][0],{\n        id: '0',\n        isOk: true\n      });\n\n    });\n\n  });\n\n  describe('#subscribe', function (){\n\n    it('has the same functionanly as sub, but different syntax', async function () {\n\n      let subscriptionId = \"\";\n\n      setTimeout(function(){\n        server.ddpConnection.emit('added',{\n          msg: 'added',\n          collection: \"test\",\n          id: '0',\n          fields: {isOk:true}\n        });\n\n        server.ddpConnection.emit('ready',{\n          msg: 'ready',\n          subs: [subscriptionId]\n        });\n      },10);\n\n      let sub = server.subscribe(\"testsub\");\n      subscriptionId = sub.subscriptionId;\n\n      await sub.ready();\n\n      assert.deepEqual(server.collections['test'][0],{\n        id: '0',\n        isOk: true\n      });\n\n    });\n\n    it('check the behavior of starting the subscription if error comes from server', function (done) {\n\n      let subscriptionId = \"\";\n\n      setTimeout(function(){\n        server.ddpConnection.emit('nosub',{id:subscriptionId,error:\"test error\"});\n      },10);\n\n      let sub = server.subscribe(\"testsub\");\n      subscriptionId = sub.subscriptionId;\n\n      sub.ready().then(function () {\n        assert.fail();\n      }).catch(function (error) {\n        assert.isNotNull(error)\n        done();\n      });\n\n    });\n\n  });\n\n  describe('#restart', function (){\n\n    it('check the behavior of restarting the subscription if error comes from server', function (done) {\n\n      let subscriptionId = \"\";\n\n      setTimeout(function(){\n        server.ddpConnection.emit('ready',{\n          msg: 'ready',\n          subs: [subscriptionId]\n        });\n      },10);\n\n      let sub = server.subscribe(\"testsub\");\n      subscriptionId = sub.subscriptionId;\n\n      sub.ready().then(function () {\n        setTimeout(function(){\n          server.ddpConnection.emit('nosub',{id:subscriptionId,error:\"test error\"});\n        },10);\n        sub.restart().then(function () {\n          assert.fail();\n        }).catch(function (error) {\n          assert.isNotNull(error)\n          done();\n        });\n      });\n\n    });\n\n  });\n\n  describe('#clearData', function (){\n\n    it('should clearData when `clearDataOnReconnection=true` and only after all `removed` message resubscribe', function (done) {\n\n      let checks = [];\n\n      server.on('added',function () {\n        checks.push('added');\n      });\n      server.on('removed',function () {\n        checks.push('removed');\n      });\n\n      server.ddpConnection.emit('added',{id:0,collection:'test',fields:{test:0}});\n      server.ddpConnection.emit('disconnected');\n      server.ddpConnection.emit('connected');\n      setTimeout(function(){\n        server.ddpConnection.emit('added',{id:0,collection:'test',fields:{test:0}});\n          setTimeout(function(){\n            assert.deepEqual(checks, ['added','removed','added']);\n            done();\n          },0);\n      },10);\n\n    });\n\n  });\n\n  after(function() {\n    // runs after all tests in this block\n    server.disconnect();\n    server = null;\n  });\n});\n"
  }
]