Skip to content

Commit bf17186

Browse files
committed
fix: update ready() function and add policy warning
1 parent 9d7fa84 commit bf17186

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/connectors/controller/index.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ export class ControllerConnector extends Connector {
2525
constructor(options: Partial<ControllerOptions> = {}) {
2626
super()
2727

28+
if (!options.policies) {
29+
console.log(
30+
"[Controller] You have no policies set for the Controller. " +
31+
"This is not typical and may lead to unexpected behavior. " +
32+
"Go to https://docs.cartridge.gg/controller/sessions to learn more about setting policies.",
33+
)
34+
}
35+
2836
this.controller = this.available()
2937
? new Controller(options as ControllerOptions)
3038
: null
@@ -45,12 +53,7 @@ export class ControllerConnector extends Connector {
4553
}
4654

4755
async ready() {
48-
if (!this.controller) {
49-
return false
50-
}
51-
52-
const account = await this.controller.probe()
53-
return account !== null
56+
return !!this.controller && this.controller.isReady()
5457
}
5558

5659
async connect(_args?: ConnectArgs): Promise<ConnectorData> {

0 commit comments

Comments
 (0)