apply a few tweaks
This commit is contained in:
parent
e7020c49de
commit
7ffb4a1819
|
@ -1,3 +1,3 @@
|
|||
module.exports = {
|
||||
"extends": "airbnb-base"
|
||||
};
|
||||
extends: 'airbnb-base'
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
media/
|
||||
.DS_Store
|
||||
node_modules/
|
||||
examples/
|
||||
|
|
|
@ -1,68 +1,56 @@
|
|||
import React, { Component } from 'react'
|
||||
import { StyleSheet, Text, View, ListView } from 'react-native'
|
||||
import React, { Component } from 'react';
|
||||
import { StyleSheet, Text, View, ListView } from 'react-native';
|
||||
|
||||
import Snoopy from 'rn-snoopy'
|
||||
import { stringify } from 'rn-snoopy/formatting'
|
||||
import bars from 'rn-snoopy/stream/bars'
|
||||
import filter from 'rn-snoopy/stream/filter'
|
||||
import buffer from 'rn-snoopy/stream/buffer'
|
||||
import Snoopy from 'rn-snoopy';
|
||||
import { stringify } from 'rn-snoopy/formatting';
|
||||
import bars from 'rn-snoopy/stream/bars';
|
||||
import filter from 'rn-snoopy/stream/filter';
|
||||
import buffer from 'rn-snoopy/stream/buffer';
|
||||
|
||||
import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter'
|
||||
const emitter = new EventEmitter()
|
||||
import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';
|
||||
const emitter = new EventEmitter();
|
||||
|
||||
const events = Snoopy.stream(emitter)
|
||||
const events = Snoopy.stream(emitter);
|
||||
|
||||
filter(info => info.method == 'createView', true)(events).subscribe()
|
||||
filter(info => info.method == 'createView', true)(events).subscribe();
|
||||
/*
|
||||
// show create views
|
||||
//
|
||||
filter((info)=> info.method == 'createView', true)(events).subscribe()
|
||||
*/
|
||||
|
||||
/*
|
||||
//draw a live graph of events
|
||||
//
|
||||
bars(info=>info.length)(
|
||||
buffer()(
|
||||
events
|
||||
)
|
||||
).subscribe()
|
||||
*/
|
||||
//bars(info => info.length)(buffer()(events)).subscribe();
|
||||
|
||||
/*
|
||||
// deep filter on args
|
||||
//
|
||||
filter({method:'asd', arg: { foo: {BAR: }}}, true)(events).subscribe()
|
||||
*/
|
||||
//filter({ method: 'asd', arg: { foo: { BAR: 1 } } }, true)(events).subscribe();
|
||||
|
||||
/*
|
||||
// use a threshold
|
||||
//
|
||||
bars(infoAry=>infoAry.length, 100, true)(
|
||||
buffer()(events)
|
||||
).subscribe()
|
||||
*/
|
||||
//bars(infoAry => infoAry.length, 100, true)(buffer()(events)).subscribe();
|
||||
|
||||
/*
|
||||
// slowmo - force communication to happen slowly by busylooping. don't
|
||||
// try this other than experiments.
|
||||
filter((info)=>{
|
||||
let i = 10000000
|
||||
while(i--){}
|
||||
return info.method == 'createView'
|
||||
}, true)(events).subscribe()
|
||||
filter(info => {
|
||||
let i = 10000000;
|
||||
while (i--) {}
|
||||
return info.method == 'createView';
|
||||
}, true)(events).subscribe();
|
||||
*/
|
||||
|
||||
import R from 'ramda'
|
||||
const data = R.range(1, 1000)
|
||||
import R from 'ramda';
|
||||
const data = R.range(1, 1000);
|
||||
|
||||
class Snoopful extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
var ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 })
|
||||
super(props);
|
||||
var ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
|
||||
this.state = {
|
||||
dataSource: ds.cloneWithRows(data)
|
||||
}
|
||||
dataSource: ds.cloneWithRows(data),
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -80,7 +68,7 @@ class Snoopful extends Component {
|
|||
pageSize={100}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,12 +77,12 @@ const styles = StyleSheet.create({
|
|||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
backgroundColor: '#F5FCFF'
|
||||
backgroundColor: '#F5FCFF',
|
||||
},
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center'
|
||||
}
|
||||
})
|
||||
alignItems: 'center',
|
||||
},
|
||||
});
|
||||
|
||||
export default Snoopful
|
||||
export default Snoopful;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"ramda": "^0.25.0",
|
||||
"react": "16.0.0",
|
||||
"react-native": "0.50.4",
|
||||
"rn-snoopy": "^2.0.0"
|
||||
"rn-snoopy": "file:../../"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-jest": "21.2.0",
|
||||
|
|
|
@ -122,6 +122,12 @@ argparse@^1.0.7:
|
|||
dependencies:
|
||||
sprintf-js "~1.0.2"
|
||||
|
||||
aria-query@^0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.7.0.tgz#4af10a1e61573ddea0cf3b99b51c52c05b424d24"
|
||||
dependencies:
|
||||
ast-types-flow "0.0.7"
|
||||
|
||||
arr-diff@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
|
||||
|
@ -144,6 +150,13 @@ array-filter@~0.0.0:
|
|||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec"
|
||||
|
||||
array-includes@^3.0.3:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.0.3.tgz#184b48f62d92d7452bb31b323165c7f8bd02266d"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
es-abstract "^1.7.0"
|
||||
|
||||
array-map@~0.0.0:
|
||||
version "0.0.0"
|
||||
resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662"
|
||||
|
@ -184,6 +197,10 @@ assert-plus@^0.2.0:
|
|||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234"
|
||||
|
||||
ast-types-flow@0.0.7:
|
||||
version "0.0.7"
|
||||
resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad"
|
||||
|
||||
astral-regex@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
|
||||
|
@ -214,6 +231,12 @@ aws4@^1.2.1, aws4@^1.6.0:
|
|||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"
|
||||
|
||||
axobject-query@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-0.1.0.tgz#62f59dbc59c9f9242759ca349960e7a2fe3c36c0"
|
||||
dependencies:
|
||||
ast-types-flow "0.0.7"
|
||||
|
||||
babel-code-frame@^6.26.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
|
||||
|
@ -1214,6 +1237,10 @@ csurf@~1.8.3:
|
|||
csrf "~3.0.0"
|
||||
http-errors "~1.3.1"
|
||||
|
||||
damerau-levenshtein@^1.0.0:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514"
|
||||
|
||||
dashdash@^1.12.0:
|
||||
version "1.14.1"
|
||||
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
|
||||
|
@ -1260,6 +1287,13 @@ default-require-extensions@^1.0.0:
|
|||
dependencies:
|
||||
strip-bom "^2.0.0"
|
||||
|
||||
define-properties@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
|
||||
dependencies:
|
||||
foreach "^2.0.5"
|
||||
object-keys "^1.0.8"
|
||||
|
||||
delayed-stream@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
|
||||
|
@ -1318,6 +1352,10 @@ ee-first@1.1.1:
|
|||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||
|
||||
emoji-regex@^6.1.0:
|
||||
version "6.5.1"
|
||||
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2"
|
||||
|
||||
encoding@^0.1.11:
|
||||
version "0.1.12"
|
||||
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
|
||||
|
@ -1353,6 +1391,24 @@ errorhandler@~1.4.2:
|
|||
accepts "~1.3.0"
|
||||
escape-html "~1.0.3"
|
||||
|
||||
es-abstract@^1.7.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864"
|
||||
dependencies:
|
||||
es-to-primitive "^1.1.1"
|
||||
function-bind "^1.1.1"
|
||||
has "^1.0.1"
|
||||
is-callable "^1.1.3"
|
||||
is-regex "^1.0.4"
|
||||
|
||||
es-to-primitive@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
|
||||
dependencies:
|
||||
is-callable "^1.1.1"
|
||||
is-date-object "^1.0.1"
|
||||
is-symbol "^1.0.1"
|
||||
|
||||
escape-html@1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.2.tgz#d77d32fa98e38c2f41ae85e9278e0e0e6ba1022c"
|
||||
|
@ -1376,6 +1432,18 @@ escodegen@^1.6.1:
|
|||
optionalDependencies:
|
||||
source-map "~0.5.6"
|
||||
|
||||
eslint-plugin-jsx-a11y@5.1.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-5.1.1.tgz#5c96bb5186ca14e94db1095ff59b3e2bd94069b1"
|
||||
dependencies:
|
||||
aria-query "^0.7.0"
|
||||
array-includes "^3.0.3"
|
||||
ast-types-flow "0.0.7"
|
||||
axobject-query "^0.1.0"
|
||||
damerau-levenshtein "^1.0.0"
|
||||
emoji-regex "^6.1.0"
|
||||
jsx-ast-utils "^1.4.0"
|
||||
|
||||
esprima@^3.1.3:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
|
||||
|
@ -1590,6 +1658,10 @@ for-own@^0.1.4:
|
|||
dependencies:
|
||||
for-in "^1.0.1"
|
||||
|
||||
foreach@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
|
||||
|
||||
forever-agent@~0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
|
||||
|
@ -1650,6 +1722,10 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2:
|
|||
mkdirp ">=0.5 0"
|
||||
rimraf "2"
|
||||
|
||||
function-bind@^1.0.2, function-bind@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
|
||||
|
||||
gauge@~1.2.5:
|
||||
version "1.2.7"
|
||||
resolved "https://registry.yarnpkg.com/gauge/-/gauge-1.2.7.tgz#e9cec5483d3d4ee0ef44b60a7d99e4935e136d93"
|
||||
|
@ -1821,6 +1897,12 @@ has-unicode@^2.0.0:
|
|||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9"
|
||||
|
||||
has@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
|
||||
dependencies:
|
||||
function-bind "^1.0.2"
|
||||
|
||||
hawk@3.1.3, hawk@~3.1.3:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4"
|
||||
|
@ -1965,12 +2047,20 @@ is-builtin-module@^1.0.0:
|
|||
dependencies:
|
||||
builtin-modules "^1.0.0"
|
||||
|
||||
is-callable@^1.1.1, is-callable@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
|
||||
|
||||
is-ci@^1.0.10:
|
||||
version "1.0.10"
|
||||
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e"
|
||||
dependencies:
|
||||
ci-info "^1.0.0"
|
||||
|
||||
is-date-object@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
|
||||
|
||||
is-dotfile@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1"
|
||||
|
@ -2035,10 +2125,20 @@ is-promise@^2.1.0:
|
|||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
|
||||
|
||||
is-regex@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
|
||||
dependencies:
|
||||
has "^1.0.1"
|
||||
|
||||
is-stream@^1.0.1, is-stream@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||
|
||||
is-symbol@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
|
||||
|
||||
is-typedarray@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
|
||||
|
@ -2456,6 +2556,10 @@ jsprim@^1.2.2:
|
|||
json-schema "0.2.3"
|
||||
verror "1.10.0"
|
||||
|
||||
jsx-ast-utils@^1.4.0:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1"
|
||||
|
||||
kind-of@^3.0.2:
|
||||
version "3.2.2"
|
||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
|
||||
|
@ -2969,6 +3073,10 @@ object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
|
|||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
|
||||
|
||||
object-keys@^1.0.8:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
|
||||
|
||||
object.omit@^2.0.0:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa"
|
||||
|
@ -3608,12 +3716,12 @@ rimraf@~2.2.6:
|
|||
version "2.2.8"
|
||||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582"
|
||||
|
||||
rn-snoopy@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/rn-snoopy/-/rn-snoopy-2.0.0.tgz#1a8ed7be7e55266a9eff782b2bc322cf701ac303"
|
||||
"rn-snoopy@file:../..":
|
||||
version "2.0.1"
|
||||
dependencies:
|
||||
eslint-plugin-jsx-a11y "5.1.1"
|
||||
lodash "^3.10.0"
|
||||
rxjs "^5.0.0-beta.10"
|
||||
rxjs "5.5.2"
|
||||
|
||||
rndm@1.2.0:
|
||||
version "1.2.0"
|
||||
|
@ -3635,9 +3743,9 @@ rx-lite@*, rx-lite@^4.0.8:
|
|||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444"
|
||||
|
||||
rxjs@^5.0.0-beta.10:
|
||||
version "5.5.3"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.3.tgz#b62227e74b84f4e77bdf440e50b5ee01a1bc7dcd"
|
||||
rxjs@5.5.2:
|
||||
version "5.5.2"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.2.tgz#28d403f0071121967f18ad665563255d54236ac3"
|
||||
dependencies:
|
||||
symbol-observable "^1.0.1"
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const normal = '▒';
|
||||
const crazy = '▇';
|
||||
|
||||
export default (valuefn = ary => ary.length, threshold = 100, yellowbox = false) =>
|
||||
events => events.do((infoAry) => {
|
||||
export default (valuefn = ary => ary.length, threshold = 100, yellowbox = false) => events =>
|
||||
events.do((infoAry) => {
|
||||
const len = valuefn(infoAry);
|
||||
|
||||
const message = () => {
|
||||
|
@ -15,5 +15,9 @@ export default (valuefn = ary => ary.length, threshold = 100, yellowbox = false)
|
|||
console.warn(`bars: event rate over threshold (${threshold}): ${len}`); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
console.log(`tick, ${message} ${len}`); // eslint-disable-line no-console
|
||||
console.log(
|
||||
'tick',
|
||||
`${(len >= threshold ? crazy : normal).repeat(Math.floor(Math.log(Math.max(len, 1))))
|
||||
}(${len})`,
|
||||
); // eslint-disable-line no-console
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue