Skip to content

Commit 2bfcc50

Browse files
committed
BEACON-25 update beacon docs for sheet-to-sheet communication
1 parent 5a091b0 commit 2bfcc50

File tree

2 files changed

+45
-25
lines changed

2 files changed

+45
-25
lines changed

content/docs/components/dispatch.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,26 @@ dispatch.setComputed({
132132
```
133133
`getComputed` and `setComputed` are both nearly identical in how they are called, taking a character id and a property with the name of the computed property you wish to get or set, and an array of string args. Both methods return a promise that resolves with the computed value.
134134

135+
## getAvailableCharacters
136+
```typescript
137+
dispatch.getAvailableCharacters(): Promise<{
138+
[id: string]: {
139+
id: string;
140+
name: string;
141+
avatar: string;
142+
permissions: "view"|"edit";
143+
characterType: string;
144+
description: string;
145+
customMeta1: string;
146+
customMeta2: string;
147+
customMeta3: string;
148+
statusmarkers: string;
149+
tags: string;
150+
}
151+
}>
152+
```
153+
`getAvailableCharacters` returns a list of all characters available to the current player. It returns the characters' metadata, as well as the player's permission level (`view` or `edit`).
154+
135155
## compendiumRequest
136156
```javascript
137157
dispatch.compendiumRequest({

content/docs/components/handlers.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,6 @@ initRelay({
3939
}): Promise<Dispatch>
4040
```
4141

42-
```typescript
43-
type Character {
44-
id: string // The character's unique ID
45-
name: string // The character's name
46-
characterType?: string // The character type metadata, i.e. PC, NPC, Vehicle, etc.
47-
description?: string // The character desciprtion metadata
48-
customMeta1?: string // Custom metadata fields
49-
customMeta2?: string
50-
customMeta3?: string
51-
attributes: JSONObject
52-
customAttributes?: CustomAttributes
53-
abilities?: Abilities
54-
playerMacros?: PlayerMacros
55-
bio?: string | null
56-
gmNotes?: string | null
57-
token: Token
58-
statusmarkers?: string
59-
avatar: string
60-
}
61-
```
62-
6342
## onInit
6443

6544
The `onInit` method receives the initial data from the host.
@@ -72,12 +51,12 @@ onInit(event: {
7251
settings: { // Campaign and character specific settings
7352
colorTheme: string, // 'dark' or 'light'
7453
language: string, // two-letter language code, i.e. 'en'
75-
gm: boolean, // whether or not the current player has gm permissions
76-
owned: boolean, // whether or not the current player controls the primary character
54+
gm: boolean, // Whether the current player has gm permissions
55+
owned: boolean, // Whether the current player controls the primary character
7756
playerSubscription: 'free'|'plus'|'pro', // The player's subscription level
7857
campaignSubscription?: 'free'|'plus'|'pro', // The campaign's subscription level
79-
settingsSheet: boolean, // whether or not this sheet is the settings sheet
80-
headless: boolean, // whether or not it should be displayed, set by the host
58+
settingsSheet: boolean, // Whether this sheet is the settings sheet
59+
headless: boolean, // Whether it should be displayed, set by the host
8160
sandbox: boolean,
8261
campaignId: number, // The id of the current campaign
8362
environment: string, // VTT, CHARACTERS, DISCORD
@@ -92,6 +71,27 @@ onInit(event: {
9271
},
9372
}, dispatch: Dispatch): void;
9473
```
74+
The `Character` data is returned in the following format:
75+
76+
```typescript
77+
type Character {
78+
id: string // The character's unique ID
79+
name: string // The character's name
80+
characterType?: string // The character type metadata, i.e. PC, NPC, Vehicle, etc.
81+
description?: string // The character desciprtion metadata
82+
customMeta1?: string // Custom metadata fields
83+
customMeta2?: string
84+
customMeta3?: string
85+
attributes: Object // The character's attributes
86+
customAttributes?: CustomAttributes // Custom attributes created by the user
87+
abilities?: Abilities // The character's abilities (macros)
88+
playerMacros?: PlayerMacros // Custom macros created by the user
89+
bio?: string | null // The character's biography metadata
90+
gmNotes?: string | null // The character's GM Notes metadata (only present if the player is GM)
91+
token: Token // The character's default token
92+
avatar: string // The url for the character's avatar
93+
}
94+
```
9595

9696
{{< callout context="note" >}}
9797
This function may be called multiple times during development in the sheet sandbox as part of hot reloads.

0 commit comments

Comments
 (0)