@powly/sdk 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/powly.d.ts +8 -3
- package/dist/powly.js +6 -2
- package/dist/powly.mjs +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ await powly.leaderboards.submit("high-score", 1200);
|
|
|
31
31
|
Without a bundler, load the classic script instead; it defines `window.Powly`:
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
|
-
<script src="https://cdn.jsdelivr.net/npm/@powly/sdk@0.
|
|
34
|
+
<script src="https://cdn.jsdelivr.net/npm/@powly/sdk@0.9.0/dist/powly.js"></script>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## Testing
|
|
@@ -58,7 +58,7 @@ your backend verifies session tokens or exchanges them for an access token.
|
|
|
58
58
|
## This repository
|
|
59
59
|
|
|
60
60
|
The SDK is developed in Powly's main repository and mirrored here with each release; this is
|
|
61
|
-
`@powly/sdk` 0.
|
|
61
|
+
`@powly/sdk` 0.9.0. Issues are welcome; changes land through the main repository.
|
|
62
62
|
|
|
63
63
|
To build it yourself (Node.js 24 or newer):
|
|
64
64
|
|
package/dist/powly.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* Powly SDK 0.
|
|
1
|
+
/* Powly SDK 0.9.0: types for powly.js and powly.mjs */
|
|
2
2
|
/** This SDK's version; Powly's Studio shows it next to the downloads. */
|
|
3
|
-
export declare const SDK_VERSION = "0.
|
|
3
|
+
export declare const SDK_VERSION = "0.9.0";
|
|
4
4
|
|
|
5
5
|
export declare const PROTOCOL = "powly-sdk";
|
|
6
6
|
export declare const PROTOCOL_VERSION = 1;
|
|
@@ -102,7 +102,7 @@ export type FailedMessage = {
|
|
|
102
102
|
error: string;
|
|
103
103
|
};
|
|
104
104
|
/** What a game may ask the Powly page for. */
|
|
105
|
-
export declare const HOST_METHODS: readonly ["getSessionToken", "purchases.open", "fullscreen.toggle", "invites.open", "players.open", "twitch.connect", "audio.set", "audio.channels", "quit"];
|
|
105
|
+
export declare const HOST_METHODS: readonly ["getSessionToken", "purchases.open", "fullscreen.toggle", "invites.open", "players.open", "twitch.connect", "audio.set", "audio.channels", "audio.open", "quit"];
|
|
106
106
|
export type HostMethod = (typeof HOST_METHODS)[number];
|
|
107
107
|
/** "players.open": what Powly's player dialog opens on. */
|
|
108
108
|
export declare const PLAYER_VIEWS: readonly ["profile", "report"];
|
|
@@ -645,6 +645,11 @@ export type AudioApi = {
|
|
|
645
645
|
* channels are ignored.
|
|
646
646
|
*/
|
|
647
647
|
set(changes: AudioChanges): Promise<void>;
|
|
648
|
+
/**
|
|
649
|
+
* Opens Powly's sound menu over the game (in its options bar), e.g. from a Sound button in
|
|
650
|
+
* the game's own menu. Resolves when the player closes it; "change" tells what they set.
|
|
651
|
+
*/
|
|
652
|
+
open(): Promise<void>;
|
|
648
653
|
/** The settings changed (in Powly's sound menu, or with `set`). */
|
|
649
654
|
on(event: "change", listener: (audio: AudioState) => void): () => void;
|
|
650
655
|
};
|
package/dist/powly.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* Powly SDK 0.
|
|
1
|
+
/* Powly SDK 0.9.0: defines window.Powly */
|
|
2
2
|
(function () {
|
|
3
3
|
"use strict";
|
|
4
4
|
/** This SDK's version; Powly's Studio shows it next to the downloads. */
|
|
5
|
-
const SDK_VERSION = "0.
|
|
5
|
+
const SDK_VERSION = "0.9.0";
|
|
6
6
|
|
|
7
7
|
// The messages between a game (this SDK, inside Powly's iframe) and the Powly page that framed it.
|
|
8
8
|
// Shared with the host side (apps/web/components/player/sdk-host.ts).
|
|
@@ -61,6 +61,7 @@ const HOST_METHODS = [
|
|
|
61
61
|
"twitch.connect",
|
|
62
62
|
"audio.set",
|
|
63
63
|
"audio.channels",
|
|
64
|
+
"audio.open",
|
|
64
65
|
"quit",
|
|
65
66
|
];
|
|
66
67
|
/** "players.open": what Powly's player dialog opens on. */
|
|
@@ -1668,6 +1669,9 @@ function createSession(port, ready, sound) {
|
|
|
1668
1669
|
const result = await call("audio.set", { audio: changes });
|
|
1669
1670
|
setAudio(audioStateOf(result, channels));
|
|
1670
1671
|
},
|
|
1672
|
+
async open() {
|
|
1673
|
+
await call("audio.open");
|
|
1674
|
+
},
|
|
1671
1675
|
on(_event, listener) {
|
|
1672
1676
|
audioListeners.add(listener);
|
|
1673
1677
|
return () => audioListeners.delete(listener);
|
package/dist/powly.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* Powly SDK 0.
|
|
1
|
+
/* Powly SDK 0.9.0: ES module */
|
|
2
2
|
/** This SDK's version; Powly's Studio shows it next to the downloads. */
|
|
3
|
-
const SDK_VERSION = "0.
|
|
3
|
+
const SDK_VERSION = "0.9.0";
|
|
4
4
|
|
|
5
5
|
// The messages between a game (this SDK, inside Powly's iframe) and the Powly page that framed it.
|
|
6
6
|
// Shared with the host side (apps/web/components/player/sdk-host.ts).
|
|
@@ -59,6 +59,7 @@ const HOST_METHODS = [
|
|
|
59
59
|
"twitch.connect",
|
|
60
60
|
"audio.set",
|
|
61
61
|
"audio.channels",
|
|
62
|
+
"audio.open",
|
|
62
63
|
"quit",
|
|
63
64
|
];
|
|
64
65
|
/** "players.open": what Powly's player dialog opens on. */
|
|
@@ -1666,6 +1667,9 @@ function createSession(port, ready, sound) {
|
|
|
1666
1667
|
const result = await call("audio.set", { audio: changes });
|
|
1667
1668
|
setAudio(audioStateOf(result, channels));
|
|
1668
1669
|
},
|
|
1670
|
+
async open() {
|
|
1671
|
+
await call("audio.open");
|
|
1672
|
+
},
|
|
1669
1673
|
on(_event, listener) {
|
|
1670
1674
|
audioListeners.add(listener);
|
|
1671
1675
|
return () => audioListeners.delete(listener);
|