Skip to content

Commit 582a1b1

Browse files
committed
[change] Rename Heatbeat.prototype.beat to pump. Expose API for pump to Microcosm
1 parent 43c8135 commit 582a1b1

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "microcosm",
3-
"version": "0.0.2",
3+
"version": "0.1.0",
44
"description": "An experimental flux implimentation",
55
"main": "dist/Microcosm.js",
66
"scripts": {

src/Microcosm.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ export default class Microcosm {
2828
return this._heart.ignore
2929
}
3030

31+
get pump() {
32+
return this._heart.pump
33+
}
34+
3135
_enqueue(payload) {
3236
for (let s in this.stores) {
3337
this.stores[s].send(payload)
3438
}
35-
this._heart.beat()
39+
this._heart.pump()
3640
}
3741

3842
addActions(actions) {

src/__tests__/heartbeat-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe ('Heartbeat', function() {
88
it ('does not flush if there are no callbacks', function() {
99
let spy = sinon.spy(window, 'requestAnimationFrame')
1010

11-
heart.beat()
11+
heart.pump()
1212

1313
spy.should.not.have.been.called
1414

@@ -17,7 +17,7 @@ describe ('Heartbeat', function() {
1717

1818
it ('can listen to callbacks', function(done) {
1919
heart.listen(done)
20-
heart.beat()
20+
heart.pump()
2121
})
2222

2323
it ('batches subscriptions', function(done) {
@@ -26,7 +26,7 @@ describe ('Heartbeat', function() {
2626
heart.listen(stub)
2727

2828
for (var i = 100; i > 0; i--) {
29-
heart.beat()
29+
heart.pump()
3030
}
3131

3232
requestAnimationFrame(() => {
@@ -40,7 +40,7 @@ describe ('Heartbeat', function() {
4040

4141
heart.listen(stub)
4242
heart.ignore(stub)
43-
heart.beat()
43+
heart.pump()
4444

4545
requestAnimationFrame(() => {
4646
stub.should.not.have.been.called

src/heartbeat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default function() {
4646
/**
4747
* Trigger every callback in the Set
4848
*/
49-
beat() {
49+
pump() {
5050
if (_callbacks.length > 0) {
5151
cancelAnimationFrame(_tick)
5252
_tick = requestAnimationFrame(_pump)

0 commit comments

Comments
 (0)