├── .editorconfig ├── .gitignore ├── .npmrc.template ├── CHANGELOG.md ├── LICENCE.md ├── Makefile ├── README.md ├── logo.png └── packages ├── bulb-input ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── rollup.config.js └── src │ ├── index.js │ ├── internal │ └── emitter.js │ ├── keyboard │ ├── keys.js │ ├── keys.test.js │ ├── state.js │ └── state.test.js │ └── mouse │ ├── buttons.js │ ├── buttons.test.js │ ├── position.js │ ├── position.test.js │ ├── state.js │ └── state.test.js └── bulb ├── README.md ├── babel.config.js ├── bulb.d.ts ├── jest.config.js ├── package-lock.json ├── package.json ├── rollup.config.js └── src ├── Bus.js ├── Bus.test.js ├── Signal.js ├── Signal.test.js ├── Subscription.js ├── combinators ├── all.js ├── all.test.js ├── always.js ├── always.test.js ├── any.js ├── any.test.js ├── apply.js ├── apply.test.js ├── buffer.js ├── buffer.test.js ├── bufferWith.js ├── bufferWith.test.js ├── catchError.js ├── catchError.test.js ├── concat.js ├── concat.test.js ├── concatMap.js ├── concatMap.test.js ├── cycle.js ├── cycle.test.js ├── debounce.js ├── debounce.test.js ├── dedupeWith.js ├── dedupeWith.test.js ├── delay.js ├── delay.test.js ├── drop.js ├── drop.test.js ├── dropUntil.js ├── dropUntil.test.js ├── dropWhile.js ├── dropWhile.test.js ├── filter.js ├── filter.test.js ├── fold.js ├── fold.test.js ├── hold.js ├── hold.test.js ├── map.js ├── map.test.js ├── merge.js ├── merge.test.js ├── sample.js ├── sample.test.js ├── scan.js ├── scan.test.js ├── sequential.js ├── sequential.test.js ├── stateMachine.js ├── stateMachine.test.js ├── switchMap.js ├── switchMap.test.js ├── take.js ├── take.test.js ├── takeUntil.js ├── takeUntil.test.js ├── takeWhile.js ├── takeWhile.test.js ├── tap.js ├── tap.test.js ├── throttle.js ├── throttle.test.js ├── window.js ├── window.test.js ├── zipLatestWith.js ├── zipLatestWith.test.js ├── zipWith.js └── zipWith.test.js ├── index.js ├── internal └── mockSignal.js └── scheduler.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [Makefile] 12 | indent_style = tab 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | node_modules 4 | -------------------------------------------------------------------------------- /.npmrc.template: -------------------------------------------------------------------------------- 1 | //registry.npmjs.org/:_authToken=${NPM_TOKEN} 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 7.0.0 (2021-03-25) 2 | 3 | * Add `Signal#bufferWith` method 4 | * Fix `Signal.zip` method 5 | * Add window combinator 6 | * Add zipLatestWith combinator 7 | * Fix `Signal.merge` function 8 | * Only complete `zipWith` signal after all signals have completed 9 | * Allow `withCallback` to handle an unmount function 10 | * Fix concat combinator 11 | * Fix take combinator 12 | * Fix takeWhile combinator 13 | * Fix `Signal.concat` function 14 | * Add typescript types 15 | 16 | ## 6.1.0 (2019-03-25) 17 | 18 | * Add `Signal#tap` method 19 | 20 | ## 6.0.0 (2019-03-23) 21 | 22 | * Refactor combinators to fix cyclical dependency warnings 23 | * Add dev dependency on Fkit 24 | * Export classes in separate files to help with bundle sizes 25 | 26 | ## 5.0.0 (2019-02-09) 27 | 28 | * Rename `value` -> `next` to match the [observable proposal](https://github.com/tc39/proposal-observable) 29 | * Remove runtime dependency on [Fkit](https://github.com/nullobject/fkit) 30 | * Mark subscriptions as closed when an observer unsubscribes 31 | * Allow `Signal.of` to take multiple arguments 32 | * Don't allow functions which take multiple arguments to an array (use the array spread syntax instead) 33 | * Rename fromArray -> from 34 | 35 | ## 4.0.1 (2019-02-04) 36 | 37 | * Fix peer dependencies for bulb-input 38 | 39 | ## 4.0.0 (2019-02-04) 40 | 41 | * Add `Bus` class 42 | 43 | ## 3.1.0 (2019-01-27) 44 | 45 | * Add `Signal#all` method 46 | * Add `Signal#any` method 47 | 48 | ## 3.0.2 (2019-01-26) 49 | 50 | * Fix issue with array arguments passed to `startWith`, `endWith`, `append`, and `prepend` methods 51 | 52 | ## 3.0.1 (2019-01-26) 53 | 54 | * Add `Signal#startWith` and `Signal#endWith` methods 55 | 56 | ## 3.0.0 (2019-01-26) 57 | 58 | * Remove `Signal.sequential` static method 59 | * Change `Signal.periodic` to emit sequential numbers 60 | * Add `Signal#first` method 61 | * Add `Signal#last` method 62 | * Add index to `map`, `filter`, `fold`, and `scan` methods 63 | * Add `Signal.merge` static method 64 | * Add `Signal.zip` static method 65 | * Add `Signal.zipWith` static method 66 | * Remove combinator functions from exports 67 | * Extract keyboard and mouse signals into `bulb-input` package 68 | 69 | ## 2.2.0 (2019-01-17) 70 | 71 | * Add `apply` function 72 | * Add `Signal.throwError` static method 73 | * Add `catchError` function 74 | * Add `Signal#catchError` method 75 | 76 | ## 2.1.0 (2019-01-12) 77 | 78 | * Add `buffer` function 79 | * Add `Signal#buffer` method 80 | 81 | ## 2.0.0 (2019-01-12) 82 | 83 | * Add `switchMap` function 84 | * Add `Signal#switchMap` method 85 | * Fix an issue where `concatMap` wouldn't wait for signals to complete 86 | * Add missing combinators to exports 87 | * Add `concat` function 88 | * Add `Signal#concat` method 89 | * Add `always` function 90 | * Add `cycle` function 91 | * Add `sequential` function 92 | * Add `prepend` function 93 | * Add `append` function 94 | * Add `Signal#prepend` method 95 | * Add `Signal#append` method 96 | * Fix an issue where exceptions were being swallowed when mounting 97 | * Add `takeUntil` function 98 | * Add `dropUntil` function 99 | * Add `Signal#takeUntil` method 100 | * Add `Signal#dropUntil` method 101 | * Reorder the arguments for `Signal#sample` and `Signal#hold` 102 | 103 | ## 1.4.0 (2019-01-08) 104 | 105 | * Add `Signal#cycle` method 106 | * Add `Signal#sequential` method 107 | * Deprecate `Signal.sequential` method (use `Signal.periodic(1000).sequential([1, 2, 3])` instead) 108 | * Remove `setTimeout` in `Signal.fromArray` method 109 | * Remove `setTimeout` in `scan` function 110 | * Unmount signals when they have completed 111 | * Add `take` function 112 | * Add `takeWhile` function 113 | * Add `drop` function 114 | * Add `dropWhile` function 115 | * Add `Signal#take` method 116 | * Add `Signal#takeWhile` method 117 | * Add `Signal#drop` method 118 | * Add `Signal#dropWhile` method 119 | 120 | ## 1.3.0 (2019-01-06) 121 | 122 | * Rename `emit.next` -> `emit.value` 123 | * Move keyboard and mouse methods to separate functions (e.g. `keyboardKeys`, `keyboardState`, `mouseButtons`, `mousePosition`, and `mouseState`) 124 | * Extract all functions to separate files 125 | * Change to documentation.js for API docs 126 | 127 | ## 1.2.0 (2018-12-30) 128 | 129 | * Switch to jest for tests 130 | * Update readme 131 | * Fix issue where some signals weren't being unmounted properly 132 | 133 | ## 1.1.1 (2018-01-24) 134 | 135 | * Fix issue with initial value scheduling 136 | * Add watch task 137 | * Fix param documentation for curried functions 138 | * Update readme 139 | * Add book search example 140 | 141 | ## 1.1.0 (2018-01-12) 142 | 143 | * Fix an issue with Signal.fromEvent 144 | * Update documentation 145 | * Rename bulb.js -> index.js 146 | * Rename combinator -> combinators 147 | 148 | ## 1.0.0 (2018-01-02) 149 | 150 | * Update rollup to 0.53.2 151 | * Update jsdoc-react to 1.0.0 152 | * Update fkit to 1.1.0 153 | * Update mocha to 4.1.0 154 | * Update documentation 155 | * Refactor keyboard and mouse modules 156 | * Add Signal#throttle and Signal#debounce 157 | * Add throttle function 158 | * Add debounce function 159 | * Curry the combinator functions 160 | * Extract combinators into modules 161 | * Update zipWith function to buffer values 162 | * Rename license to licence 163 | * Remove sampleWith and holdWith functions 164 | * Ensure signal combinators are unsubscribed 165 | * Add Signal#encode 166 | * Add Signal#switch 167 | * Allow Signal#merge to receieve signals as an array 168 | * Update copyright in license 169 | * Don't export default from main module 170 | * Rename observer -> emit 171 | * Refactor subscribe calls to use object reset spread 172 | 173 | ## 0.4.0 (2017-12-18) 174 | 175 | * Fix rollup packaging 176 | * Allow merge to take many arguments 177 | * Refactor stateMachine to take observer argument 178 | 179 | ## 0.3.2 (2017-12-17) 180 | 181 | * Store keyboard state in a set 182 | * Add Signal#startWith function 183 | 184 | ## 0.3.1 (2017-12-16) 185 | 186 | * Don't generate duplicate keyboard events 187 | * Handle no transform function result in Signal#stateMachine 188 | 189 | ## 0.3.0 (2017-12-16) 190 | 191 | * Add Signal#stateMachine function 192 | 193 | ## 0.2.0 (2017-12-16) 194 | 195 | * First cut of the API 196 | 197 | ## 0.1.0 (2014-11-06) 198 | 199 | * Initial import 200 | -------------------------------------------------------------------------------- /LICENCE.md: -------------------------------------------------------------------------------- 1 | The MIT Licence (MIT) 2 | 3 | Copyright (c) 2018 Josh Bassett 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean dev dist doc lint node_modules publish-api publish-npm release test watch 2 | 3 | node_modules: 4 | @cd packages/bulb; npm install 5 | @cd packages/bulb-input; npm install 6 | 7 | dev: 8 | @cd packages/bulb; npx rollup -c -w 9 | 10 | dist: 11 | @rm -rf packages/bulb/dist packages/bulb-input/dist 12 | @cd packages/bulb; npx rollup -c 13 | @cd packages/bulb-input; npx rollup -c 14 | 15 | test: 16 | @cd packages/bulb; npx jest 17 | 18 | watch: 19 | @cd packages/bulb; npx jest --watch 20 | 21 | lint: 22 | @cd packages/bulb; npx standard "src/**/*.js" 23 | @cd packages/bulb-input; npx standard "src/**/*.js" 24 | 25 | release: dist doc publish-api publish-npm 26 | 27 | doc: 28 | @cd packages/bulb; npx documentation build src/** -f html -o docs 29 | 30 | publish-api: 31 | @aws s3 sync ./packages/bulb/docs/ s3://bulb.joshbassett.info/ --acl public-read --delete --cache-control 'max-age=300' 32 | 33 | publish-npm: 34 | @cd packages/bulb; npm publish 35 | @cd packages/bulb-input; npm publish 36 | 37 | clean: 38 | @rm -rf packages/bulb/dist packages/bulb-input/dist docs 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |