From f4fd1db9268c447a07b02d2f71cd85664c1de276 Mon Sep 17 00:00:00 2001 From: Zechariah Date: Wed, 30 Mar 2022 23:20:40 +0800 Subject: [PATCH] Return this after initialize so you can initialize it in 1 line --- docs/guides/usage.md | 7 +++++++ src/YTMusic.ts | 2 ++ 2 files changed, 9 insertions(+) diff --git a/docs/guides/usage.md b/docs/guides/usage.md index 9b38fb7..42894a5 100644 --- a/docs/guides/usage.md +++ b/docs/guides/usage.md @@ -10,3 +10,10 @@ ytmusic.initialize().then(() => { // Use API here }) ``` + +In an async context, you can initialize the API in one line + +```ts +const ytmusic = await new YTMusic().initalize() +// Use API here +``` diff --git a/src/YTMusic.ts b/src/YTMusic.ts index 34c137a..35dba43 100644 --- a/src/YTMusic.ts +++ b/src/YTMusic.ts @@ -104,6 +104,8 @@ export default class YTMusic { ...config } } + + return this } /**