From f21ab39bdf3430d801b96fd9e94234c3a40e96b5 Mon Sep 17 00:00:00 2001 From: Favour Date: Fri, 14 Jun 2024 14:30:31 +0100 Subject: [PATCH] chore: update ReadMe and examples folder --- README.md | 21 +++++++++++++++++++++ examples/spotify.ts | 14 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 examples/spotify.ts diff --git a/README.md b/README.md index 2893bdf..241b53b 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,24 @@ const np = new NowPlaying(Providers.SPOTIFY, { storageKind: StorageKinds.INMEMORY, }); ``` + + +### With Spotify +```ts +import { + NowPlaying, + Providers, + StorageKinds, +} from "@BolajiOlajide/now-playing"; + +const np = new NowPlaying(Providers.SPOTIFY, { + storageKind: StorageKinds.INMEMORY, + useCache: false, // default is true + cacheDuration: 30000, // in milliseconds + streamerArgs: { + clientId: "foo", + clientSecret: "bar", + refreshToken: "baz", + } +}); +``` diff --git a/examples/spotify.ts b/examples/spotify.ts new file mode 100644 index 0000000..6d54fe4 --- /dev/null +++ b/examples/spotify.ts @@ -0,0 +1,14 @@ +import { NowPlaying, Providers, StorageKinds } from "../src"; + +const np = new NowPlaying(Providers.SPOTIFY, { + storageKind: StorageKinds.INMEMORY, + useCache: false, + cacheDuration: 30000, // in milliseconds + streamerArgs: { + clientId: "foo", + clientSecret: "bar", + refreshToken: "baz", + } +}); + +console.log("Hello World", np);