Skip to content

Commit

Permalink
singletonやめた
Browse files Browse the repository at this point in the history
  • Loading branch information
na2na-p committed Jan 9, 2024
1 parent 1c3c4e9 commit fec28f0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/features/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export type { CommandBase } from './internal/CommandBase/index.js';
export { Ping } from './internal/Ping/index.js';
export { VoiceChannel } from './internal/VoiceChannel/index.js';
export { YouTube } from './internal/YouTube/index.js';
export { getSpotifyInstance } from './internal/Spotify/index.js';
export { Spotify } from './internal/Spotify/index.js';
7 changes: 1 addition & 6 deletions src/features/commands/internal/Spotify/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
import { singleton } from '@/features/others/singleton/index.js';

import { Spotify } from './internal/Spotify.class.js';

const createSpotifyInstance = () => new Spotify();
export const getSpotifyInstance = singleton(createSpotifyInstance);
export { Spotify } from './internal/Spotify.class.js';
10 changes: 2 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ import {
Ping,
VoiceChannel,
YouTube,
getSpotifyInstance,
Spotify,
} from './features/commands/index.js';
import { getConfig } from './features/config/index.js';
import { Client } from './features/core/index.js';

new Client({
config: getConfig(),
commands: [
new Ping(),
new VoiceChannel(),
new YouTube(),
// TODO: シングルトンやめる
getSpotifyInstance(),
],
commands: [new Ping(), new VoiceChannel(), new YouTube(), new Spotify()],
});

0 comments on commit fec28f0

Please sign in to comment.