aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/obj-multiplex.js
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-09-19 02:38:39 +0800
committerGitHub <noreply@github.com>2017-09-19 02:38:39 +0800
commita190bb60437e2edcdf7b9be39e69f2d34f2b0957 (patch)
tree64d0547165cbed1af2df5eec1d856c6c1847448d /app/scripts/lib/obj-multiplex.js
parent54bbf8d8590014b92e7857f30bdc2d8f3779431a (diff)
parent162a3827c7ba418ce8180d81c54ad09d9b9560b8 (diff)
downloadtangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.tar.gz
tangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.tar.zst
tangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.zip
Merge pull request #2116 from chikeichan/nm
[NewUI] Fix merge conflict with latest master
Diffstat (limited to 'app/scripts/lib/obj-multiplex.js')
-rw-r--r--app/scripts/lib/obj-multiplex.js48
1 files changed, 0 insertions, 48 deletions
diff --git a/app/scripts/lib/obj-multiplex.js b/app/scripts/lib/obj-multiplex.js
deleted file mode 100644
index 0034febe0..000000000
--- a/app/scripts/lib/obj-multiplex.js
+++ /dev/null
@@ -1,48 +0,0 @@
-const through = require('through2')
-
-module.exports = ObjectMultiplex
-
-function ObjectMultiplex (opts) {
- opts = opts || {}
- // create multiplexer
- const mx = through.obj(function (chunk, enc, cb) {
- const name = chunk.name
- const data = chunk.data
- if (!name) {
- console.warn(`ObjectMultiplex - Malformed chunk without name "${chunk}"`)
- return cb()
- }
- const substream = mx.streams[name]
- if (!substream) {
- console.warn(`ObjectMultiplex - orphaned data for stream "${name}"`)
- } else {
- if (substream.push) substream.push(data)
- }
- return cb()
- })
- mx.streams = {}
- // create substreams
- mx.createStream = function (name) {
- const substream = mx.streams[name] = through.obj(function (chunk, enc, cb) {
- mx.push({
- name: name,
- data: chunk,
- })
- return cb()
- })
- mx.on('end', function () {
- return substream.emit('end')
- })
- if (opts.error) {
- mx.on('error', function () {
- return substream.emit('error')
- })
- }
- return substream
- }
- // ignore streams (dont display orphaned data warning)
- mx.ignoreStream = function (name) {
- mx.streams[name] = true
- }
- return mx
-}