Skip to content

Commit c1c9918

Browse files
committed
♻️ (Navigation) rename instance into singleton
1 parent b926fa4 commit c1c9918

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/FullScreenPortal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Navigation } from './Navigation';
66

77
export class FullScreenPortal extends ReactComponent {
88
fullScreenStack = fromStream(
9-
Navigation.getInstance().fullScreenDelegate.fullSceenStack$
9+
Navigation.instance.fullScreenDelegate.fullSceenStack$
1010
);
1111

1212
render() {

src/Navigation/Navigation.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { FullScreenDelegate } from './FullScreenDelegate';
22

33
export class Navigation {
4-
static getInstance() {
5-
if (Navigation.instance) {
6-
return Navigation.instance;
4+
static get instance() {
5+
if (Navigation.singleton) {
6+
return Navigation.singleton;
77
}
8-
Navigation.instance = new Navigation();
9-
return Navigation.instance;
8+
Navigation.singleton = new Navigation();
9+
return Navigation.singleton;
1010
}
11-
private static instance: Navigation;
11+
private static singleton: Navigation;
1212

1313
fullScreenDelegate = new FullScreenDelegate();
1414
}

src/__tests__/Navigation.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Navigation } from '../Navigation';
22

33
describe('Navigation store', () => {
44
it('exposes the same store instance if it accessed twice', () => {
5-
const navigation = Navigation.getInstance();
6-
const otherNavigation = Navigation.getInstance();
5+
const navigation = Navigation.instance;
6+
const otherNavigation = Navigation.instance;
77
expect(otherNavigation).toBe(navigation);
88
});
99
});

src/createCanal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const createCanal = <
102102
*/
103103
// @ts-ignore
104104
this.authorizations$.next(nextAuthorizations);
105-
Navigation.getInstance().fullScreenDelegate.canalsFullScreenStackProperties$.next(
105+
Navigation.instance.fullScreenDelegate.canalsFullScreenStackProperties$.next(
106106
this.fullScreenStackProperties$
107107
);
108108
}

0 commit comments

Comments
 (0)