{
	"name": "worker-rpc",
	"versions": {
		"0.1.0": {
			"name": "worker-rpc",
			"version": "0.1.0",
			"description": "A simple RPC layer for communicating with web workers and over other transports",
			"scripts": {
				"prepublish": "tsc",
				"pretest": "typings install && tsc -p tsconfig.test.json",
				"test": "mocha -R spec -u tdd test"
			},
			"author": {
				"name": "Christian Speckner",
				"email": "cnspeckn@googlemail.com",
				"url": "https://github.com/DirtyHairy/"
			},
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git+https://github.com/DirtyHairy/worker-rpc.git"
			},
			"keywords": [
				"worker",
				"rpc"
			],
			"devDependencies": {
				"mocha": "~3.1.0",
				"typescript": "~2.0.3",
				"typings": "~1.4.0"
			},
			"main": "lib/index.js",
			"types": "lib/index.d.ts",
			"dependencies": {
				"microevent.ts": "~0.1.0"
			},
			"gitHead": "64875680bff6f4006b1c755b6799d1e3fe195dac",
			"bugs": {
				"url": "https://github.com/DirtyHairy/worker-rpc/issues"
			},
			"homepage": "https://github.com/DirtyHairy/worker-rpc#readme",
			"_id": "worker-rpc@0.1.0",
			"_shasum": "5f1258dca3d617cd18ca86587f8a05ac0eebd834",
			"_from": ".",
			"_npmVersion": "3.10.3",
			"_nodeVersion": "6.7.0",
			"_npmUser": {
				"name": "dirtyhairy",
				"email": "cnspeckn@googlemail.com"
			},
			"dist": {
				"shasum": "5f1258dca3d617cd18ca86587f8a05ac0eebd834",
				"tarball": "https://registry.npmjs.org/worker-rpc/-/worker-rpc-0.1.0.tgz"
			},
			"maintainers": [
				{
					"name": "dirtyhairy",
					"email": "cnspeckn@googlemail.com"
				}
			],
			"_npmOperationalInternal": {
				"host": "packages-18-east.internal.npmjs.com",
				"tmp": "tmp/worker-rpc-0.1.0.tgz_1478299072197_0.678148998413235"
			},
			"directories": {},
			"contributors": []
		},
		"0.1.1": {
			"name": "worker-rpc",
			"version": "0.1.1",
			"description": "A simple RPC layer for communicating with web workers and over other transports",
			"scripts": {
				"prepublish": "tsc",
				"pretest": "typings install && tsc -p tsconfig.test.json",
				"test": "mocha -R spec -u tdd test"
			},
			"author": {
				"name": "Christian Speckner",
				"email": "cnspeckn@googlemail.com",
				"url": "https://github.com/DirtyHairy/"
			},
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git+https://github.com/DirtyHairy/worker-rpc.git"
			},
			"keywords": [
				"worker",
				"rpc"
			],
			"devDependencies": {
				"mocha": "~6.1.4",
				"typescript": "~3.4.5",
				"typings": "~2.1.1"
			},
			"main": "lib/index.js",
			"types": "lib/index.d.ts",
			"dependencies": {
				"microevent.ts": "~0.1.1"
			},
			"gitHead": "738fec6b388865da99b4f0f1f853d2347e7533e1",
			"bugs": {
				"url": "https://github.com/DirtyHairy/worker-rpc/issues"
			},
			"homepage": "https://github.com/DirtyHairy/worker-rpc#readme",
			"_id": "worker-rpc@0.1.1",
			"_npmVersion": "5.6.0",
			"_nodeVersion": "8.11.3",
			"_npmUser": {
				"name": "dirtyhairy",
				"email": "cnspeckn@googlemail.com"
			},
			"dist": {
				"integrity": "sha512-P1WjMrUB3qgJNI9jfmpZ/htmBEjFh//6l/5y8SD9hg1Ef5zTTVVoRjTrTEzPrNBQvmhMxkoTsjOXN10GWU7aCg==",
				"shasum": "cb565bd6d7071a8f16660686051e969ad32f54d5",
				"tarball": "https://registry.npmjs.org/worker-rpc/-/worker-rpc-0.1.1.tgz",
				"fileCount": 18,
				"unpackedSize": 105324,
				"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3sB5CRA9TVsSAnZWagAAEI4P/iV2Cr1ZQzigIJvviUTr\nEBnuD+IxuZbWMtR5j3EWXUDbtBx+v11P+Lvth6jaU2dQ692ToFy/PXQpDPpA\nFuGnbQdEKl7JaDuzIMiLys4up/zJh/Vywf6VG+a8n1vmt5FKFyyIR4w54f/a\n6mgyyKoZEr9kiQmrAzJPL5FS9h5DfCoDjjl+c4ZXNr5tz3vawWNuTwFb6U1X\nw9XfkTaybBRyDVlGUCqB8toJUSCSvzPPdZeB+l++AC8s0Pp6KFpP65YWWWqh\nrAsJxYwa2Xt9lwBnDUG2WZL1tNrVg9xOsMsFfauMl1TLuEshLLI0EK2ce1J6\nMrFldlUkuNlVEL+2voxUPGJltcMyLcXNZu1QH3ojZPzf1gRjg1KBhiBHdq1g\nMnY6f3ZvhdeNoagJUjN/OyssVYkLgjLHOk5NV97685tSRjivYv8/8D1pmCIR\nFdPS/rfzM4PpBJOVyxhju97EY9KSORSLFNuQ4yDEZnfq2kipuDkhjAgAiL46\nQZbos9adiKQwOQ2GDlNQ9joiB8OrLBzdQUjahXo+wGswKNrPhUw2UNQ7txxG\nMjihbDnpZxtMfVrnTs9jNczMXByvksjC3nXaxPqBTKhPnOxmTn3XOV8f5VZ2\nz0INgwzDFuOngusCCJQFAbx8UK4F4D7PjaVbTGPi7aPoYRjyFzda7g1en3KY\n51od\r\n=hC/K\r\n-----END PGP SIGNATURE-----\r\n"
			},
			"maintainers": [
				{
					"name": "dirtyhairy",
					"email": "cnspeckn@googlemail.com"
				}
			],
			"directories": {},
			"_npmOperationalInternal": {
				"host": "s3://npm-registry-packages",
				"tmp": "tmp/worker-rpc_0.1.1_1558102136673_0.8769591251671542"
			},
			"_hasShrinkwrap": false,
			"contributors": []
		},
		"0.2.0": {
			"name": "worker-rpc",
			"version": "0.2.0",
			"description": "A simple RPC layer for communicating with web workers and over other transports",
			"scripts": {
				"prepublish": "tsc",
				"test": "mocha --require ts-node/register -R spec -u tdd 'test/**/*.ts'"
			},
			"author": {
				"name": "Christian Speckner",
				"email": "cnspeckn@googlemail.com",
				"url": "https://github.com/DirtyHairy/"
			},
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git+https://github.com/DirtyHairy/worker-rpc.git"
			},
			"keywords": [
				"worker",
				"rpc"
			],
			"devDependencies": {
				"@types/mocha": "^5.2.6",
				"@types/node": "^12.0.2",
				"mocha": "~6.1.4",
				"ts-node": "^8.1.0",
				"typescript": "~3.4.5"
			},
			"main": "lib/index.js",
			"types": "lib/index.d.ts",
			"dependencies": {
				"microevent.ts": "~0.2.1"
			},
			"gitHead": "cc7c1ea05770771054eff7065b005f852769f191",
			"bugs": {
				"url": "https://github.com/DirtyHairy/worker-rpc/issues"
			},
			"homepage": "https://github.com/DirtyHairy/worker-rpc#readme",
			"_id": "worker-rpc@0.2.0",
			"_npmVersion": "5.6.0",
			"_nodeVersion": "8.11.3",
			"_npmUser": {
				"name": "dirtyhairy",
				"email": "cnspeckn@googlemail.com"
			},
			"dist": {
				"integrity": "sha512-S74HnfAdmMlUYmr6+Lx6TmxvffM2vRZSk4RfI/Bxco4xZGw+FREzLRZhFxf8QIzI2/5NKNMn5+Pj69Bp+rweIg==",
				"shasum": "24528f2820bc83a09d5a6b2e715842df8443e710",
				"tarball": "https://registry.npmjs.org/worker-rpc/-/worker-rpc-0.2.0.tgz",
				"fileCount": 18,
				"unpackedSize": 36180,
				"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc4dQHCRA9TVsSAnZWagAAUkAP/ip6ZfU6hauu6sa9NZXS\nRl83dJOOMZmQzG3lLQlgeCcNIlGlP4MNh73ObyueCkvF+3bNBcA1PN18Xvg9\n7tuMplFkAZfsv518R2eYHxe+ufk0CVSnPtNDG3GbJ+6Tx1jE3cbHl9FqLF6M\n0zv+i8lYJStSNswDss8w2x5WKOWEDcS3FxxkehBjCA4RmlYBRbOVlIk9Khgy\nlcIrlFkYNknCHP4QySEqvUFWxdRS1dOYqHG5dmyKcN+O7hUkmye1Nm0aKNf7\ny7mJ8srJIfFLhUu+xydYs8MxvYkyPNL+vel0htjFEsO2+Abg1BgldXdOn5cq\nfG9UTvnIFvuM814lzmZSguP6OMVin9DvGf38jtFMYnxFp4oP/UclVviqb2xa\nAipa8meYlASJns0s6wsDG85CxWnMCcfOVB5jf2fTEYUvB9vNisK9o8q3p3h1\nXO+wWwEWh4YzXiNYSX4agp9sCR5TLIcu8xmA9x+MieDsMf5B7wXljOO9RZv9\nkqzrHF7RRlF8+ONbpUfgp33AUslmppatJuZ94OvPr1NwFAppFdLGEn188YAJ\np8f5CtcGYIMzXMH0M9gju2+kPdjvjcy4LrZwYz93HFecp0pPjjjCfK/0IRFC\nOoL4i0dy+JoEqofzCnfvgLiMueR4FihKm4Sxim7RIF7Y/Uy6DeyKUm0HXWiJ\nUeVh\r\n=gUUB\r\n-----END PGP SIGNATURE-----\r\n"
			},
			"maintainers": [
				{
					"name": "dirtyhairy",
					"email": "cnspeckn@googlemail.com"
				}
			],
			"directories": {},
			"_npmOperationalInternal": {
				"host": "s3://npm-registry-packages",
				"tmp": "tmp/worker-rpc_0.2.0_1558303750476_0.9278485431786754"
			},
			"_hasShrinkwrap": false,
			"contributors": []
		}
	},
	"time": {
		"modified": "2019-05-19T22:09:13.147Z",
		"created": "2016-11-04T22:37:52.700Z",
		"0.1.0": "2016-11-04T22:37:52.700Z",
		"0.1.1": "2019-05-17T14:08:56.837Z",
		"0.2.0": "2019-05-19T22:09:10.569Z"
	},
	"users": {},
	"dist-tags": {
		"latest": "0.2.0"
	},
	"_uplinks": {
		"npmjs": {
			"etag": "W/\"a317eb50ef95f004ccd1039d85f3e4ae\"",
			"fetched": 1600679308019
		}
	},
	"_distfiles": {
		"worker-rpc-0.1.0.tgz": {
			"url": "https://registry.npmjs.org/worker-rpc/-/worker-rpc-0.1.0.tgz",
			"sha": "5f1258dca3d617cd18ca86587f8a05ac0eebd834",
			"registry": "npmjs"
		},
		"worker-rpc-0.1.1.tgz": {
			"url": "https://registry.npmjs.org/worker-rpc/-/worker-rpc-0.1.1.tgz",
			"sha": "cb565bd6d7071a8f16660686051e969ad32f54d5",
			"registry": "npmjs"
		},
		"worker-rpc-0.2.0.tgz": {
			"url": "https://registry.npmjs.org/worker-rpc/-/worker-rpc-0.2.0.tgz",
			"sha": "24528f2820bc83a09d5a6b2e715842df8443e710",
			"registry": "npmjs"
		}
	},
	"_attachments": {
		"worker-rpc-0.1.1.tgz": {
			"shasum": "cb565bd6d7071a8f16660686051e969ad32f54d5"
		}
	},
	"_rev": "2-108b68adbbd96de4",
	"_id": "worker-rpc",
	"readme": "[![Build Status](https://travis-ci.org/DirtyHairy/worker-rpc.svg?branch=master)](https://travis-ci.org/DirtyHairy/worker-rpc)\n[![npm version](https://badge.fury.io/js/worker-rpc.svg)](https://badge.fury.io/js/worker-rpc)\n\n# What is it?\n\nThis package provides a simple RPC mechanism on top of any transport that transfers\nJSON data. It was initially conceived to provide communication with web workers\n(and as such supports transferables), but it can be used on top of many other\ndifferent transport channels, i.e. `postMessage` between frames, websockets via\n`socket.io` or JSON encoded messages over pipes.\n\n# How to use it?\n\n## Installation\n\nYou can install the library into your project via npm\n\n    npm install worker-rpc\n\nThe library is written in Typescript and will work in any environment that\nsupports ES5 and ES6-style promises (either native or through a shim).\nNo external typings are required for using this library with Typescript (version >= 2).\n\n## Web worker example\n\nIn this example, we use the library to set up communication with a web worker.\n\n### Web worker\n\n    import {RpcProvider} from 'worker-rpc';\n\n    const rpcProvider = new RpcProvider(\n        (message, transfer) => postMessage(message, transfer)\n    );\n\n    onmessage = e => rpcProvider.dispatch(e.data);\n\n    rpcProvider.registerRpcHandler('add', ({x, y}) => x + y);\n\nThe RPC provider is initialized with a function that dispatches a message.\nThis function will receive an opaque message object as first argument, and\na list of transferables as second argument. This allows to leverage transfer\nof ownership instead of copying between worker and host page.\n\nOn incoming messages, `dispatch` is called on the RPC provider in order to\nhandle the message.\n\nEach registered RPC handler is identified by a message ID (`add` in this example)\nand has a handler function that receives the message object and can return a\nresult either as an immediate value or as a promise. \n\n### Page\n\n    import {RpcProvider} from 'worker-rpc';\n\n    const worker = new Worker('worker.js'),\n        rpcProvider = new RpcProvider(\n            (message, transfer) => worker.postMessage(message, transfer)\n        );\n    \n    worker.onmessage = e => rpcProvider.dispatch(e.data);\n\n    rpcProvider\n        .rpc('add', {x: 1, y: 2})\n        .then(result => console.log(result)); // 3\n\n## Importing\n\nES5 / CommonJS\n\n    var RpcProvider = require('worker-rpc').RpcProvider;\n\nES6\n\n    import {RpcProvider} from 'worker-rpc';\n\nTypescript\n\n    import {RpcProvider, RpcProviderInterface} from 'worker-rpc';\n\n##  API\n\nThe API is built around the `RpcProvider` class. A `RpcProvider` acts both as\nclient and server for RPC calls and event-like signals. The library uses ES6\npromises and can consume any A+ compliant promises.\n\n### Creating a new provider\n\n    const rpc = new RpcProvider(dispatcher, timeout);\n\n * `dispatcher`: A function that will be called for dispatching messages. The\n    first argument will be an opaque message object, and the second argument\n    an error of `Transferable` objects that are to be passed via ownership\n    transfer (if supported by the transport).\n * `timeout` (optional): The timeout for RPC transactions in milliseconds.\n    Values of `0` or smaller disable the timeout (this is the default).\n\n### Incoming messages\n\n    rpc.dispatch(message);\n\nSimilar to message dispatch, `worker-rpc` does not provide a built-in mechanism\nfor receiving messages. Instead, incoming messages must be relayed to the provider\nby invoking `dispatch`.\n\n * `message`: The received message.\n\n### Registering RPC handlers\n\n    rpc.registerRpcHandler(id, handler);\n\nRegister a handler function for RPC calls with id `id`. Returns the provider instance.\n\n * `id`: RPC call id. Only a single handler can be registered for any id. Ids should\n    be strings.\n * `handler`: The handler function. This function receives the payload object as\n    its argument and can return its result either as an immediate value or as a \n    promise.\n\n### Registering signal handlers\n\n    rpc.registerSignalHandler(id, handler));\n\nRegister a handler function for signals with id `id`. Returns the provider instance.\n\n * `id`: Signal id. The namespace for signal ids is seperate from that of RPC ids,\n    and multiple handlers my be attached tp a single signal. Ids should be strings\n * `handler`: The handler function. This function receives the payload object as\n    its argument; the result is ignored.\n\n### Dispatching RPC calls\n\n    const result = rpc.rpc(id, payload, transfer);\n\nDispatch a RPC call and returns a promise for its result. The promise is rejected\nif the call times out or if no handler is registered (or if the handler rejects\nthe operation).\n\n * `id`: RPC call id.\n * `payload` (optional): RPC call payload.\n * `transfer` (optional): List of `Transferables` that will be passed to dispatched\n   (see above).\n\n### Dispatching signals\n\n    rpc.signal(id, payload, transfer);\n\nDispatch a signal. Returns the provider instance.\n\n * `id`: Signal id.\n * `payload` (optional): Signal payload.\n * `transfer` (optional): List of `Transferables` that will be passed to dispatched\n   (see above).\n\n### Deregistering RPC handlers\n\n    rpc.deregisterRpcHandler(id, handler);\n\n`id` and `handler` must be the same arguments used for `registerRpcHandler`.\nReturns the provider instance.\n\n### Deregistering signal handlers\n\n    rpc.deregisterSignalHandler(id, handler);\n\n`id` and `handler` must be the same arguments used for `registerSignalHandler`.\nReturns the provider instance.\n\n### Errors\n\n    rpc.error.addHandler(errorHandler);\n\nThe error event is dispatched if there is either a local or remote communcation\nerror (timeout, invalid id, etc.). Checkout the\n[microevent.ts](https://github.com/DirtyHairy/microevent)\ndocumentation for the event API.\n\n# License\n\nFeel free to use this library under the conditions of the MIT license."
}