Skip to content

Commit 06061b1

Browse files
committed
chore: renamed the methods from subscribe/unsubscribe to mount/unmount
1 parent 9078261 commit 06061b1

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

packages/fireworks-js/src/fireworks.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ export class Fireworks {
6363
}
6464

6565
this.running = true
66-
this.resize.subscribe()
67-
this.mouse.subscribe()
68-
this.raf.start()
66+
this.resize.mount()
67+
this.mouse.mount()
68+
this.raf.mount()
6969
}
7070

7171
stop(dispose = false): void {
7272
if (!this.running) return
7373

7474
this.running = false
75-
this.resize.unsubscribe()
76-
this.mouse.unsubscribe()
77-
this.raf.stop()
75+
this.resize.unmount()
76+
this.mouse.unmount()
77+
this.raf.unmount()
7878
this.clear()
7979

8080
if (dispose) {
@@ -103,9 +103,9 @@ export class Fireworks {
103103
pause(): void {
104104
this.running = !this.running
105105
if (this.running) {
106-
this.raf.start()
106+
this.raf.mount()
107107
} else {
108-
this.raf.stop()
108+
this.raf.unmount()
109109
}
110110
}
111111

packages/fireworks-js/src/mouse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ export class Mouse {
1818
return this.fw.options.mouse
1919
}
2020

21-
subscribe(): void {
21+
mount(): void {
2222
this.canvas.addEventListener('pointerdown', this.pointerDown)
2323
this.canvas.addEventListener('pointerup', this.pointerUp)
2424
this.canvas.addEventListener('pointermove', this.pointerMove)
2525
}
2626

27-
unsubscribe(): void {
27+
unmount(): void {
2828
this.canvas.removeEventListener('pointerdown', this.pointerDown)
2929
this.canvas.removeEventListener('pointerup', this.pointerUp)
3030
this.canvas.removeEventListener('pointermove', this.pointerMove)

packages/fireworks-js/src/raf.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class RequestAnimationFrame {
1313
private readonly render: () => void
1414
) {}
1515

16-
start(): void {
16+
mount(): void {
1717
this.now = performance.now()
1818
const interval = 1000 / this.fps
1919

@@ -31,7 +31,7 @@ export class RequestAnimationFrame {
3131
this.rafId = requestAnimationFrame(raf)
3232
}
3333

34-
stop() {
34+
unmount() {
3535
cancelAnimationFrame(this.rafId)
3636
}
3737
}

packages/fireworks-js/src/resize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ export class Resize {
55
this.handleResize = this.handleResize.bind(this)
66
}
77

8-
subscribe(): void {
8+
mount(): void {
99
if (this.fw.options.autoresize) {
1010
window.addEventListener('resize', this.handleResize)
1111
}
1212
}
1313

14-
unsubscribe(): void {
14+
unmount(): void {
1515
if (this.fw.options.autoresize) {
1616
window.removeEventListener('resize', this.handleResize)
1717
}

0 commit comments

Comments
 (0)