{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "9eda6959-2c43-48da-85be-8850d2b83856", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Launching server... Done\n", "Serving files from '//webroot'\n", "Click to open: http://localhost:5000/\n", "[Client browser connected]\n", "[info ] livejs connection established\n" ] } ], "source": [ "%serve \"../webroot\", \"localhost\", 5000" ] }, { "cell_type": "code", "execution_count": 2, "id": "7af3b296-4f82-4406-a88a-77c1301d2bc1", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"

LiveJS Demo

\"" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "document.body.innerHTML = '

LiveJS Demo

'" ] }, { "cell_type": "code", "execution_count": 3, "id": "db456cd5-13ab-4f2f-9ce3-0210cd2cbd35", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "=== Promise result ===\n", "[object Object]\n", "{\n", " \"did\": \"did:plc:bd7snaz7voyhnbybtpdj67go\",\n", " \"handle\": \"cduck.me\",\n", " \"displayName\": \"cduck\",\n", " \"avatar\": \"https://cdn.bsky.app/img/avatar/plain/did:plc:bd7snaz7voyhnbybtpdj67go/bafkreie3nfduaawet7vnpmgav5d5i6v3l2ermeydtuk3aom74jd3qvcypm\",\n", " \"associated\": {\n", " \"lists\": 0,\n", " \"feedgens\": 0,\n", " \"starterPacks\": 0,\n", " \"labeler\": false,\n", " \"chat\": {\n", " \"allowIncoming\": \"all\"\n", " },\n", " \"activitySubscription\": {\n", " \"allowSubscriptions\": \"followers\"\n", " },\n", " \"germ\": {\n", " \"showButtonTo\": \"usersIFollow\",\n", " \"messageMeUrl\": \"https://landing.ger.mx/newUser\"\n", " }\n", " },\n", " \"labels\": [],\n", " \"createdAt\": \"2025-10-13T17:26:00.074Z\",\n", " \"description\": \"I am an engineer, architect, and artist building quantum computers at QuEra. More at https://cduck.me/\\n\\nContact me at\\nEmail: https://cduck.me/#contact\\nGerm: https://ger.mx/A-pnjCYaKnsXvg9HorAbBR2otyYL1dqI3rWYZ1qEAIth#did:plc:bd7snaz7voyhnbybtpdj67go\",\n", " \"indexedAt\": \"2026-01-29T11:50:05.245Z\",\n", " \"followersCount\": 20,\n", " \"followsCount\": 215,\n", " \"postsCount\": 0\n", "}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%async\n", "response = await fetch(\n", " 'https://public.api.bsky.app/xrpc/app.bsky.actor.getProfile'\n", " + '?actor=cduck.me');\n", "content = JSON.parse(await response.text());\n", "return content" ] }, { "cell_type": "code", "execution_count": 4, "id": "c207bb80-d270-4d9c-9804-bd8c3703dc38", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"https://cdn.bsky.app/img/avatar/plain/did:plc:bd7snaz7voyhnbybtpdj67go/bafkreie3nfduaawet7vnpmgav5d5i6v3l2ermeydtuk3aom74jd3qvcypm\"" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "img = document.getElementById('out');\n", "img.src = content.avatar;" ] } ], "metadata": { "kernelspec": { "display_name": "LiveJS", "language": "javascript", "name": "livejs" }, "language_info": { "file_extension": ".js", "mimetype": "text/javascript", "name": "javascript" } }, "nbformat": 4, "nbformat_minor": 5 }