From fea8894782e784c696a135890dcd9e375eca7378 Mon Sep 17 00:00:00 2001 From: Justin Bakse Date: Mon, 13 Feb 2023 14:19:52 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20provide=20default=20param=20for=20"?= =?UTF-8?q?room"=20on=20partyConnect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- public/examples/!empty_sketch/index.js | 2 +- public/examples/ball_drop/index.js | 2 +- public/examples/chess/index.js | 2 +- public/examples/click_history/index.js | 2 +- public/examples/cover_up/index.js | 2 +- public/examples/cursors/index.js | 2 +- public/examples/d12/index.js | 2 +- public/examples/drag/index.js | 2 +- public/examples/e2_host_timer/index.js | 2 +- public/examples/e2_host_timer/index_solution.js | 2 +- public/examples/e3_sign_up/index.js | 2 +- public/examples/e3_sign_up/index_solution.js | 2 +- public/examples/e4_sound_board/index.js | 2 +- public/examples/e4_sound_board/index_solution.js | 2 +- public/examples/frogs/index.js | 2 +- public/examples/ghosts/index.js | 2 +- public/examples/ghosts/index_1.js | 2 +- public/examples/ghosts/index_2.js | 2 +- public/examples/ghosts/index_3.js | 2 +- public/examples/ghosts/index_4.js | 2 +- public/examples/hello_cdn/index.js | 2 +- public/examples/hello_party/index.js | 2 +- public/examples/hello_watch/index.js | 2 +- public/examples/idle_clicker/index.js | 2 +- public/examples/info_panel/index.js | 2 +- public/examples/is_host/index.js | 2 +- public/examples/p5_objects/index.js | 2 +- public/examples/pixel_edit/index.js | 2 +- public/examples/pong/index.js | 2 +- public/examples/rock_paper_scissors/index.js | 2 +- public/examples/rock_paper_scissors_2/index.js | 2 +- public/examples/rocks/party.js | 2 +- public/examples/set_shared/index.js | 2 +- public/examples/stickies/index.js | 2 +- public/examples/tanks/index.js | 2 +- public/examples/tic_tac_toe/index.js | 2 +- public/examples/tile_mapper/index.js | 2 +- public/examples/timer/index.js | 2 +- public/examples/type_errors/index.js | 2 +- src/p5.party.ts | 2 +- 41 files changed, 41 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index fc26af4..b4e2556 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ let shared; function preload() { // connect to server - partyConnect("...", "hello_party", "main"); + partyConnect("...", "hello_party"); // load a shared data object shared = partyLoadShared("shared"); diff --git a/public/examples/!empty_sketch/index.js b/public/examples/!empty_sketch/index.js index 106cb09..ce76bf2 100644 --- a/public/examples/!empty_sketch/index.js +++ b/public/examples/!empty_sketch/index.js @@ -1,7 +1,7 @@ let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "empty_example", "main"); + partyConnect("wss://demoserver.p5party.org", "empty_example"); shared = partyLoadShared("shared"); } diff --git a/public/examples/ball_drop/index.js b/public/examples/ball_drop/index.js index f5478a1..1747c53 100644 --- a/public/examples/ball_drop/index.js +++ b/public/examples/ball_drop/index.js @@ -2,7 +2,7 @@ let host; let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "ball_drop", "main"); + partyConnect("wss://demoserver.p5party.org", "ball_drop"); shared = partyLoadShared("shared"); host = partyLoadShared("host"); } diff --git a/public/examples/chess/index.js b/public/examples/chess/index.js index 25c9747..b590230 100644 --- a/public/examples/chess/index.js +++ b/public/examples/chess/index.js @@ -27,7 +27,7 @@ let chess_set; let selection = false; window.preload = () => { - partyConnect("wss://demoserver.p5party.org", "chess", "main"); + partyConnect("wss://demoserver.p5party.org", "chess"); shared = partyLoadShared("shared"); chess_set = loadImage("./chess_8.png"); }; diff --git a/public/examples/click_history/index.js b/public/examples/click_history/index.js index 5688370..c0452bd 100644 --- a/public/examples/click_history/index.js +++ b/public/examples/click_history/index.js @@ -1,7 +1,7 @@ let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "click_history", "main"); + partyConnect("wss://demoserver.p5party.org", "click_history"); shared = partyLoadShared("globals", { x: 0, y: 0, diff --git a/public/examples/cover_up/index.js b/public/examples/cover_up/index.js index b7bbb78..9e69116 100644 --- a/public/examples/cover_up/index.js +++ b/public/examples/cover_up/index.js @@ -8,7 +8,7 @@ let me; let guests; window.preload = () => { - partyConnect("wss://demoserver.p5party.org", "cover_up", "main"); + partyConnect("wss://demoserver.p5party.org", "cover_up"); shared = partyLoadShared("shared"); me = partyLoadMyShared(); guests = partyLoadGuestShareds(); diff --git a/public/examples/cursors/index.js b/public/examples/cursors/index.js index e12758c..47515e6 100644 --- a/public/examples/cursors/index.js +++ b/public/examples/cursors/index.js @@ -4,7 +4,7 @@ let me; let guests; function preload() { - partyConnect("wss://demoserver.p5party.org", "cursors", "main1"); + partyConnect("wss://demoserver.p5party.org", "cursors"); me = partyLoadMyShared({ x: 200, y: 200 }); guests = partyLoadGuestShareds(); } diff --git a/public/examples/d12/index.js b/public/examples/d12/index.js index e11a908..15f4a17 100644 --- a/public/examples/d12/index.js +++ b/public/examples/d12/index.js @@ -46,7 +46,7 @@ let sprites; function preload() { // get shared data - partyConnect("wss://demoserver.p5party.org", "d12", "main"); + partyConnect("wss://demoserver.p5party.org", "d12"); shared = partyLoadShared("main"); players = partyLoadGuestShareds(); me = partyLoadMyShared(); diff --git a/public/examples/drag/index.js b/public/examples/drag/index.js index a777869..15a849b 100644 --- a/public/examples/drag/index.js +++ b/public/examples/drag/index.js @@ -5,7 +5,7 @@ const my_id = Math.random(); let shared; window.preload = () => { - partyConnect("wss://demoserver.p5party.org", "drag_2", "main"); + partyConnect("wss://demoserver.p5party.org", "drag_2"); shared = partyLoadShared("shared"); }; diff --git a/public/examples/e2_host_timer/index.js b/public/examples/e2_host_timer/index.js index 2129305..1bd18ca 100644 --- a/public/examples/e2_host_timer/index.js +++ b/public/examples/e2_host_timer/index.js @@ -3,7 +3,7 @@ let shared; function preload() { // ? - partyConnect("wss://demoserver.p5party.org", "host_timer", "main"); + partyConnect("wss://demoserver.p5party.org", "host_timer"); // ? shared = partyLoadShared("shared"); diff --git a/public/examples/e2_host_timer/index_solution.js b/public/examples/e2_host_timer/index_solution.js index ba2f6b6..1be6a53 100644 --- a/public/examples/e2_host_timer/index_solution.js +++ b/public/examples/e2_host_timer/index_solution.js @@ -3,7 +3,7 @@ let shared; function preload() { // connect to the p5.party server - partyConnect("wss://demoserver.p5party.org", "host_timer", "main"); + partyConnect("wss://demoserver.p5party.org", "host_timer"); // load the shared object shared = partyLoadShared("shared"); diff --git a/public/examples/e3_sign_up/index.js b/public/examples/e3_sign_up/index.js index d8d8976..d1796aa 100644 --- a/public/examples/e3_sign_up/index.js +++ b/public/examples/e3_sign_up/index.js @@ -4,7 +4,7 @@ let me; // ? function preload() { // ? - partyConnect("wss://demoserver.p5party.org", "sign_up", "main"); + partyConnect("wss://demoserver.p5party.org", "sign_up"); // ? guests = partyLoadGuestShareds(); diff --git a/public/examples/e3_sign_up/index_solution.js b/public/examples/e3_sign_up/index_solution.js index 429e5b4..c2fc020 100644 --- a/public/examples/e3_sign_up/index_solution.js +++ b/public/examples/e3_sign_up/index_solution.js @@ -4,7 +4,7 @@ let me; // a shared object for this client function preload() { // connect to p5.party server - partyConnect("wss://demoserver.p5party.org", "sign_up", "main"); + partyConnect("wss://demoserver.p5party.org", "sign_up"); // load shared objects for all connected clients, including this one guests = partyLoadGuestShareds(); diff --git a/public/examples/e4_sound_board/index.js b/public/examples/e4_sound_board/index.js index e777f5e..e22fbab 100644 --- a/public/examples/e4_sound_board/index.js +++ b/public/examples/e4_sound_board/index.js @@ -2,7 +2,7 @@ const sounds = {}; // ? function preload() { // ? - partyConnect("wss://demoserver.p5party.org", "sound_board", "main"); + partyConnect("wss://demoserver.p5party.org", "sound_board"); // ? sounds.closed_hat = loadSound("assets/closed_hat.wav"); diff --git a/public/examples/e4_sound_board/index_solution.js b/public/examples/e4_sound_board/index_solution.js index 9e26526..772a88d 100644 --- a/public/examples/e4_sound_board/index_solution.js +++ b/public/examples/e4_sound_board/index_solution.js @@ -2,7 +2,7 @@ const sounds = {}; // object to hold loaded sounds function preload() { // connect to the p5.party server - partyConnect("wss://demoserver.p5party.org", "sound_board", "main"); + partyConnect("wss://demoserver.p5party.org", "sound_board"); // begin loading each sound, store them as properties of the sounds object sounds.closed_hat = loadSound("assets/closed_hat.wav"); diff --git a/public/examples/frogs/index.js b/public/examples/frogs/index.js index 501a2c3..b0c77dc 100644 --- a/public/examples/frogs/index.js +++ b/public/examples/frogs/index.js @@ -143,7 +143,7 @@ function preload() { soundLib.intro = loadSound(`./assets/frogger_sfx_intro.wav`); soundLib.title = loadSound(`./assets/frogger_sfx_title.wav`); - partyConnect("wss://demoserver.p5party.org", "frogs", "main"); + partyConnect("wss://demoserver.p5party.org", "frogs"); shared = partyLoadShared("shared", { lanes: [ { pos: 0 }, diff --git a/public/examples/ghosts/index.js b/public/examples/ghosts/index.js index df0c2b4..aab6e6c 100644 --- a/public/examples/ghosts/index.js +++ b/public/examples/ghosts/index.js @@ -57,7 +57,7 @@ function keyReleased() { // setup function preload() { - partyConnect("wss://demoserver.p5party.org", "ghosts", "main"); + partyConnect("wss://demoserver.p5party.org", "ghosts"); me = partyLoadMyShared({ initialized: true }); guests = partyLoadGuestShareds(); } diff --git a/public/examples/ghosts/index_1.js b/public/examples/ghosts/index_1.js index e08dc9d..1625d38 100644 --- a/public/examples/ghosts/index_1.js +++ b/public/examples/ghosts/index_1.js @@ -1,7 +1,7 @@ // let shared; // function preload() { -// partyConnect("wss://demoserver.p5party.org", "ghosts", "main"); +// partyConnect("wss://demoserver.p5party.org", "ghosts"); // shared = partyLoadShared("shared"); // } diff --git a/public/examples/ghosts/index_2.js b/public/examples/ghosts/index_2.js index 5ab3c2d..8c5c311 100644 --- a/public/examples/ghosts/index_2.js +++ b/public/examples/ghosts/index_2.js @@ -2,7 +2,7 @@ // let me; // function preload() { -// partyConnect("wss://demoserver.p5party.org", "ghosts", "main"); +// partyConnect("wss://demoserver.p5party.org", "ghosts"); // me = partyLoadMyShared(); // guests = partyLoadGuestShareds(); // } diff --git a/public/examples/ghosts/index_3.js b/public/examples/ghosts/index_3.js index c997242..ddf6b68 100644 --- a/public/examples/ghosts/index_3.js +++ b/public/examples/ghosts/index_3.js @@ -2,7 +2,7 @@ let guests; let me; function preload() { - partyConnect("wss://demoserver.p5party.org", "ghosts", "main"); + partyConnect("wss://demoserver.p5party.org", "ghosts"); me = partyLoadMyShared(); guests = partyLoadGuestShareds(); } diff --git a/public/examples/ghosts/index_4.js b/public/examples/ghosts/index_4.js index 7c81274..3675176 100644 --- a/public/examples/ghosts/index_4.js +++ b/public/examples/ghosts/index_4.js @@ -16,7 +16,7 @@ let me; // } function preload() { - partyConnect("wss://demoserver.p5party.org", "ghosts", "main"); + partyConnect("wss://demoserver.p5party.org", "ghosts"); me = partyLoadMyShared(); guests = partyLoadGuestShareds(); } diff --git a/public/examples/hello_cdn/index.js b/public/examples/hello_cdn/index.js index 890cfba..e234f54 100644 --- a/public/examples/hello_cdn/index.js +++ b/public/examples/hello_cdn/index.js @@ -2,7 +2,7 @@ let shared; function preload() { // connect to the party server - partyConnect("wss://demoserver.p5party.org", "hello_cdn", "main"); + partyConnect("wss://demoserver.p5party.org", "hello_cdn"); // begin loading shared object // setup() won't be called until the shared object is loaded diff --git a/public/examples/hello_party/index.js b/public/examples/hello_party/index.js index cba1cbc..0639ddb 100644 --- a/public/examples/hello_party/index.js +++ b/public/examples/hello_party/index.js @@ -2,7 +2,7 @@ let shared; function preload() { // connect to the party server - partyConnect("wss://demoserver.p5party.org", "hello_party", "main"); + partyConnect("wss://demoserver.p5party.org", "hello_party"); // begin loading shared object // and provide starting values for the object to be used diff --git a/public/examples/hello_watch/index.js b/public/examples/hello_watch/index.js index bc673d0..8125a54 100644 --- a/public/examples/hello_watch/index.js +++ b/public/examples/hello_watch/index.js @@ -1,6 +1,6 @@ let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "hello_watch", "main1"); + partyConnect("wss://demoserver.p5party.org", "hello_watch"); shared = partyLoadShared("shared", { x: 0, y: 0 }); } diff --git a/public/examples/idle_clicker/index.js b/public/examples/idle_clicker/index.js index 093ce62..b2d1e3b 100644 --- a/public/examples/idle_clicker/index.js +++ b/public/examples/idle_clicker/index.js @@ -1,7 +1,7 @@ let me, guests; function preload() { - partyConnect("wss://demoserver.p5party.org", "idle_clicker", "main"); + partyConnect("wss://demoserver.p5party.org", "idle_clicker"); guests = partyLoadGuestShareds(); me = partyLoadMyShared({ score: 0, name: pick(names) }); } diff --git a/public/examples/info_panel/index.js b/public/examples/info_panel/index.js index 48b78b1..d2d5949 100644 --- a/public/examples/info_panel/index.js +++ b/public/examples/info_panel/index.js @@ -1,7 +1,7 @@ let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "info_panel", "main"); + partyConnect("wss://demoserver.p5party.org", "info_panel"); shared = partyLoadShared("shared"); } diff --git a/public/examples/is_host/index.js b/public/examples/is_host/index.js index b02431a..90642c0 100644 --- a/public/examples/is_host/index.js +++ b/public/examples/is_host/index.js @@ -1,7 +1,7 @@ let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "is_host", "main"); + partyConnect("wss://demoserver.p5party.org", "is_host"); shared = partyLoadShared("globals", { clicks: [], startTime: Date.now(), diff --git a/public/examples/p5_objects/index.js b/public/examples/p5_objects/index.js index ed9eb6e..f6b11a9 100644 --- a/public/examples/p5_objects/index.js +++ b/public/examples/p5_objects/index.js @@ -1,7 +1,7 @@ let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "p5_objects", "main"); + partyConnect("wss://demoserver.p5party.org", "p5_objects"); shared = partyLoadShared("shared"); } diff --git a/public/examples/pixel_edit/index.js b/public/examples/pixel_edit/index.js index 4214bdc..09c54de 100644 --- a/public/examples/pixel_edit/index.js +++ b/public/examples/pixel_edit/index.js @@ -17,7 +17,7 @@ const palette = [ ]; function preload() { - partyConnect("wss://demoserver.p5party.org", "pixel_edit", "main"); + partyConnect("wss://demoserver.p5party.org", "pixel_edit"); shared = partyLoadShared("shared"); } diff --git a/public/examples/pong/index.js b/public/examples/pong/index.js index 386c762..54803c9 100644 --- a/public/examples/pong/index.js +++ b/public/examples/pong/index.js @@ -5,7 +5,7 @@ let me; let guests; window.preload = () => { - partyConnect("wss://demoserver.p5party.org", "pong", "main3"); + partyConnect("wss://demoserver.p5party.org", "pong"); shared = partyLoadShared("shared"); me = partyLoadMyShared({ role: "observer", y: 20 }); guests = partyLoadGuestShareds(); diff --git a/public/examples/rock_paper_scissors/index.js b/public/examples/rock_paper_scissors/index.js index acf8f0d..184e46c 100644 --- a/public/examples/rock_paper_scissors/index.js +++ b/public/examples/rock_paper_scissors/index.js @@ -40,7 +40,7 @@ let my, guests; function preload() { // connect to the party server - partyConnect("wss://demoserver.p5party.org", "hello_party", "main"); + partyConnect("wss://demoserver.p5party.org", "hello_party"); shared = partyLoadShared("shared", {}); my = partyLoadMyShared({ x: 100, y: 100, show: false, role: "observer" }); diff --git a/public/examples/rock_paper_scissors_2/index.js b/public/examples/rock_paper_scissors_2/index.js index 6e9ac0f..dd07cbf 100644 --- a/public/examples/rock_paper_scissors_2/index.js +++ b/public/examples/rock_paper_scissors_2/index.js @@ -63,7 +63,7 @@ function preload() { imageLib.draw = loadImage(`./assets/draw.png`); // connect to the party server - partyConnect("wss://demoserver.p5party.org", "hello_party", "main"); + partyConnect("wss://demoserver.p5party.org", "hello_party"); shared = partyLoadShared("shared", {}); my = partyLoadMyShared({ x: 100, y: 100, show: false, role: "observer" }); diff --git a/public/examples/rocks/party.js b/public/examples/rocks/party.js index 8d12393..5a5cbf3 100644 --- a/public/examples/rocks/party.js +++ b/public/examples/rocks/party.js @@ -53,7 +53,7 @@ import { initRock, initRocks, updateRocks } from "./gameStatePlay.js"; export let hostData, me, guests; export function preload() { - partyConnect("wss://demoserver.p5party.org", "rocks", "main"); + partyConnect("wss://demoserver.p5party.org", "rocks"); hostData = partyLoadShared("host", { rocks: initRocks() }); me = partyLoadMyShared({}); diff --git a/public/examples/set_shared/index.js b/public/examples/set_shared/index.js index 1b15498..6a0bdcd 100644 --- a/public/examples/set_shared/index.js +++ b/public/examples/set_shared/index.js @@ -1,6 +1,6 @@ let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "set_shared", "main"); + partyConnect("wss://demoserver.p5party.org", "set_shared"); shared = partyLoadShared("shared", {}); } diff --git a/public/examples/stickies/index.js b/public/examples/stickies/index.js index 7f78654..4ef81c2 100644 --- a/public/examples/stickies/index.js +++ b/public/examples/stickies/index.js @@ -23,7 +23,7 @@ const my_id = Math.random(); // quick and dirty id let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "stickies", "main"); + partyConnect("wss://demoserver.p5party.org", "stickies"); shared = partyLoadShared("shared"); } diff --git a/public/examples/tanks/index.js b/public/examples/tanks/index.js index 6216ae4..04880f1 100644 --- a/public/examples/tanks/index.js +++ b/public/examples/tanks/index.js @@ -6,7 +6,7 @@ let stats; let shared, my, guests; window.preload = () => { - partyConnect("wss://demoserver.p5party.org", "tanks_2", "main"); + partyConnect("wss://demoserver.p5party.org", "tanks_2"); shared = partyLoadShared("shared", { bullets: [] }); my = partyLoadMyShared(); guests = partyLoadGuestShareds(); diff --git a/public/examples/tic_tac_toe/index.js b/public/examples/tic_tac_toe/index.js index 5365e21..df55daa 100644 --- a/public/examples/tic_tac_toe/index.js +++ b/public/examples/tic_tac_toe/index.js @@ -16,7 +16,7 @@ const squares = [ let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "tic_tac_toe", "main"); + partyConnect("wss://demoserver.p5party.org", "tic_tac_toe"); shared = partyLoadShared("shared"); } diff --git a/public/examples/tile_mapper/index.js b/public/examples/tile_mapper/index.js index a5db6a6..51ef47c 100644 --- a/public/examples/tile_mapper/index.js +++ b/public/examples/tile_mapper/index.js @@ -9,7 +9,7 @@ let overlay_checkbox, road_checkbox; let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "tile_mapper", "main"); + partyConnect("wss://demoserver.p5party.org", "tile_mapper"); shared = partyLoadShared("globals"); road_set = loadImage("./road.png"); diff --git a/public/examples/timer/index.js b/public/examples/timer/index.js index db978ce..da9e33f 100644 --- a/public/examples/timer/index.js +++ b/public/examples/timer/index.js @@ -4,7 +4,7 @@ const PLAYING_DURATION = 4000; let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "timer", "main"); + partyConnect("wss://demoserver.p5party.org", "timer"); shared = partyLoadShared("globals", { gameState: "waiting", // waiting, playing startTime: Date.now(), diff --git a/public/examples/type_errors/index.js b/public/examples/type_errors/index.js index efd1564..14d4e21 100644 --- a/public/examples/type_errors/index.js +++ b/public/examples/type_errors/index.js @@ -1,7 +1,7 @@ let shared; function preload() { - partyConnect("wss://demoserver.p5party.org", "type_errors", "main"); + partyConnect("wss://demoserver.p5party.org", "type_errors"); shared = partyLoadShared("shared"); } diff --git a/src/p5.party.ts b/src/p5.party.ts index c122ec2..a95e2ab 100644 --- a/src/p5.party.ts +++ b/src/p5.party.ts @@ -30,7 +30,7 @@ function init() { p5.prototype.partyConnect = function ( host: string, appName: string, - roomName: string, + roomName = "_main", cb?: () => void ) { if (room !== null) {