@leofcoin/peernet 0.10.7 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +49 -49
  3. package/coverage/lcov-report/block-navigation.js +8 -0
  4. package/coverage/lcov-report/codec-format-interface.js.html +224 -120
  5. package/coverage/lcov-report/dht-response.js.html +44 -39
  6. package/coverage/lcov-report/index.html +39 -64
  7. package/coverage/lcov-report/sorter.js +26 -0
  8. package/coverage/lcov.info +164 -424
  9. package/dist/browser/peernet.js +101788 -93018
  10. package/dist/commonjs/client-1a1f75e6.js +324 -0
  11. package/dist/commonjs/{codec-6367213c.js → codec-8c8c652f.js} +198 -188
  12. package/dist/commonjs/codec-format-interface.js +169 -152
  13. package/dist/commonjs/codec.js +4 -4
  14. package/dist/commonjs/dht-response.js +13 -13
  15. package/dist/commonjs/dht.js +24 -24
  16. package/dist/commonjs/hash.js +151 -141
  17. package/dist/commonjs/{http-a94c5a81.js → http-7bbac90a.js} +19 -15
  18. package/dist/commonjs/peernet-message.js +13 -13
  19. package/dist/commonjs/peernet.js +1901 -1794
  20. package/dist/commonjs/request.js +13 -13
  21. package/dist/commonjs/response.js +13 -13
  22. package/dist/module/peernet.js +2460 -2346
  23. package/index.html +4 -6
  24. package/package.json +22 -14
  25. package/rollup.config.js +33 -5
  26. package/rollup0.config.js +7 -0
  27. package/src/client.js +75 -75
  28. package/src/codec/codec-format-interface.js +172 -155
  29. package/src/codec/codec.js +124 -114
  30. package/src/codec/codecs.js +79 -79
  31. package/src/dht/dht.js +121 -121
  32. package/src/discovery/peer-discovery.js +75 -75
  33. package/src/handlers/message.js +52 -52
  34. package/src/hash/hash.js +155 -145
  35. package/src/http/client/http-client.js +44 -44
  36. package/src/messages/chat-message.js +14 -14
  37. package/src/messages/data-response.js +14 -14
  38. package/src/messages/data.js +18 -18
  39. package/src/messages/dht-response.js +14 -15
  40. package/src/messages/dht.js +25 -25
  41. package/src/messages/peer-response.js +14 -14
  42. package/src/messages/peer.js +14 -14
  43. package/src/messages/peernet-message.js +14 -14
  44. package/src/messages/ps.js +14 -14
  45. package/src/messages/request.js +14 -14
  46. package/src/messages/response.js +14 -14
  47. package/src/peer.js +67 -67
  48. package/src/peernet.js +612 -697
  49. package/src/proto/chat-message.proto.js +7 -7
  50. package/src/utils/utils.js +78 -78
  51. package/test/codec.js +3 -2
  52. package/test/messages.js +7 -4
  53. package/test.js +11 -4
  54. package/webpack.config.js +35 -0
  55. package/coverage/lcov-report/codec.js.html +0 -677
  56. package/coverage/lcov-report/hash.js.html +0 -551
  57. package/debug.log +0 -3
  58. package/dist/browser/peernet.js.tmp-browserify-14074318104595318069 +0 -0
  59. package/dist/browser/peernet.js.tmp-browserify-45407634493269122267 +0 -0
  60. package/dist/browser/peernet.js.tmp-browserify-53722389064799025427 +0 -0
  61. package/dist/browser/peernet.js.tmp-browserify-96323030449218949300 +0 -0
  62. package/dist/codec/codec-format-interface.js +0 -433
  63. package/dist/codec/codec.js +0 -199
  64. package/dist/commonjs/codec-73adfc0f.js +0 -205
  65. package/dist/commonjs/http-2c603501.js +0 -324
  66. package/dist/commonjs/http-42a6e555.js +0 -324
  67. package/dist/commonjs/http-43f4fafe.js +0 -324
  68. package/dist/commonjs/peernet-message-b6925673.js +0 -32
  69. package/dist/hash/hash.js +0 -340
  70. package/dist/messages/dht-response.js +0 -454
  71. package/dist/messages/dht.js +0 -453
  72. package/dist/messages/peernet.js +0 -456
  73. package/dist/module/http-273664bd.js +0 -317
  74. package/dist/module/http-8fe3c0d7.js +0 -317
  75. package/dist/module/http-c780c991.js +0 -317
  76. package/dist/module/http-f13e0d77.js +0 -317
package/LICENSE CHANGED
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,49 +1,49 @@
1
- # socket-discovery
2
-
3
- ## Usage
4
- ```js
5
- import discovery from 'socket-discovery'
6
- ```
7
-
8
- ## API
9
- #### addRequestHandler
10
-
11
- examples
12
- ```js
13
- peernet.addRequestHandler('lastBlock', () => {
14
- let response;
15
- const height = await chainStore.get('localIndex')
16
- const hash = await chainStore.get('localBlock')
17
- response = JSON.stringify({ height: height.toString(), hash: hash.toString() })
18
- return new ResponseMessage({ response })
19
- // or
20
- return new peernet.protos['peernet-response']({ response })
21
- })
22
- ```
23
-
24
- ```js
25
- peernet.addRequestHandler('hello', () => {
26
- return new ResponseMessage({ response: 'hi' })
27
- // or
28
- return new peernet.protos['peernet-response']({ response: 'hi' })
29
- })
30
- ```
31
-
32
- ## Development
33
- ### watch
34
- ```sh
35
- npm run w
36
- ```
37
- ### compile
38
- ```sh
39
- npm run c
40
- ```
41
- ### serve html
42
- ```sh
43
- npm run demo
44
- ```
45
-
46
- `note: you need to install jsproject`
47
- ```sh
48
- npm i -g @vandeurenglenn/project
49
- ```
1
+ # socket-discovery
2
+
3
+ ## Usage
4
+ ```js
5
+ import discovery from 'socket-discovery'
6
+ ```
7
+
8
+ ## API
9
+ #### addRequestHandler
10
+
11
+ examples
12
+ ```js
13
+ peernet.addRequestHandler('lastBlock', () => {
14
+ let response;
15
+ const height = await chainStore.get('localIndex')
16
+ const hash = await chainStore.get('localBlock')
17
+ response = JSON.stringify({ height: height.toString(), hash: hash.toString() })
18
+ return new ResponseMessage({ response })
19
+ // or
20
+ return new peernet.protos['peernet-response']({ response })
21
+ })
22
+ ```
23
+
24
+ ```js
25
+ peernet.addRequestHandler('hello', () => {
26
+ return new ResponseMessage({ response: 'hi' })
27
+ // or
28
+ return new peernet.protos['peernet-response']({ response: 'hi' })
29
+ })
30
+ ```
31
+
32
+ ## Development
33
+ ### watch
34
+ ```sh
35
+ npm run w
36
+ ```
37
+ ### compile
38
+ ```sh
39
+ npm run c
40
+ ```
41
+ ### serve html
42
+ ```sh
43
+ npm run demo
44
+ ```
45
+
46
+ `note: you need to install jsproject`
47
+ ```sh
48
+ npm i -g @vandeurenglenn/project
49
+ ```
@@ -63,6 +63,14 @@ var jumpToCode = (function init() {
63
63
  }
64
64
 
65
65
  return function jump(event) {
66
+ if (
67
+ document.getElementById('fileSearch') === document.activeElement &&
68
+ document.activeElement != null
69
+ ) {
70
+ // if we're currently focused on the search input, we don't want to navigate
71
+ return;
72
+ }
73
+
66
74
  switch (event.which) {
67
75
  case 78: // n
68
76
  case 74: // j