Versions

  • v20

    4/13/2024
    Open: Version
    Changes from v19 to v20
    +28
    -1
    ⦚ 62 unchanged lines ⦚
    }
    }">
    {/* ... */}
    </body>
    </html>
    ⦚ 5 unchanged lines ⦚
    ⦚ 62 unchanged lines ⦚
    }
    }">
    <h1>Val Town Eval Sandbox</h1>
    <div>
    <textarea
    x-model="code"
    rows="10"
    cols="50"
    placeholder="Enter code to evaluate"
    ></textarea>
    </div>
    <div>
    <pre x-text="JSON.stringify({ code }, null, 2)"></pre>
    </div>
    <div>
    <button
    x-on:click="evaluate()"
    x-bind:disabled="isEvaluating"
    >
    Evaluate
    </button>
    </div>
    <div x-show="isEvaluating">
    <p>Evaluating... <span x-text="elapsedTime"></span> seconds</p>
    <div class="loader"></div>
    </div>
    <div x-show="!isEvaluating">
    <h2>Result:</h2>
    <pre x-text="result"></pre>
    </div>
    </body>
    </html>
    ⦚ 5 unchanged lines ⦚
  • v19

    4/13/2024
    Open: Version
    Changes from v18 to v19
    +0
    -0
    ⦚ 72 unchanged lines ⦚
    ⦚ 72 unchanged lines ⦚
  • v18

    4/13/2024
    Open: Version
    Changes from v17 to v18
    +36
    -60
    ⦚ 27 unchanged lines ⦚
    `}</style>
    </head>
    <body x-data="{
    code: '',
    result: '',
    isEvaluating: false,
    elapsedTime: 0,
    async evaluate() {
    this.isEvaluating = true;
    this.elapsedTime = 0;
    this.startTimer();
    try {
    const payload = { code: this.code };
    const response = await fetchJSON('https://api.val.town/v1/eval', {
    method: 'POST',
    body: JSON.stringify(payload)
    });
    this.result = JSON.stringify(response, null, 2);
    } catch (error) {
    this.result = JSON.stringify(error, null, 2);
    } finally {
    this.isEvaluating = false;
    this.stopTimer();
    }
    },
    startTimer() {
    this.timer = setInterval(() => {
    this.elapsedTime++;
    }, 1000);
    },
    stopTimer() {
    clearInterval(this.timer);
    }
    }">
    ⦚ 27 unchanged lines ⦚
    `}</style>
    </head>
    <body x-data="{
    code: '',
    result: '',
    isEvaluating: false,
    elapsedTime: 0,
    async evaluate() {
    this.isEvaluating = true;
    this.elapsedTime = 0;
    this.startTimer();
    try {
    const payload = { code: this.code };
    console.log('Sending payload:', payload);
    const response = await fetchJSON('https://api.val.town/v1/eval', {
    method: 'POST',
    body: JSON.stringify(payload)
    });
    console.log('Received response:', response);
    this.result = JSON.stringify(response, null, 2);
    } catch (error) {
    console.error('Error:', error);
    this.result = JSON.stringify(error, null, 2);
    } finally {
    this.isEvaluating = false;
    this.stopTimer();
    }
    },
    startTimer() {
    this.timer = setInterval(() => {
    this.elapsedTime++;
    }, 1000);
    },
    stopTimer() {
  • v17

    4/13/2024
    Open: Version
    Changes from v16 to v17
    +2
    -1
    /** @jsxImportSource https://esm.sh/hono@3.1.3/jsx */
    import { Hono } from "https://deno.land/x/hono@v3.1.3/mod.ts";
    import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";

    ⦚ 91 unchanged lines ⦚
    /** @jsx jsx */
    import { Hono } from "https://deno.land/x/hono@v3.1.3/mod.ts";
    import { jsx } from "https://deno.land/x/hono@v3.1.3/middleware.ts";
    import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";

    ⦚ 91 unchanged lines ⦚
  • v16

    4/13/2024
    Open: Version
    Changes from v15 to v16
    +19
    -1
    ⦚ 11 unchanged lines ⦚
    <title>Val Town Eval Sandbox</title>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
    </head>
    <body x-data="{
    code: '',
    ⦚ 6 unchanged lines ⦚
    this.startTimer();
    try {
    const response = await fetchJSON('https://api.val.town/v1/eval', {
    method: 'POST',
    body: JSON.stringify({ code: this.code })
    });
    this.result = JSON.stringify(response, null, 2);
    ⦚ 22 unchanged lines ⦚
    placeholder="Enter code to evaluate"
    ></textarea>
    </div>
    <div>
    ⦚ 22 unchanged lines ⦚
    ⦚ 11 unchanged lines ⦚
    <title>Val Town Eval Sandbox</title>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
    <style>{`
    .loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    }
    @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
    }
    `}</style>
    </head>
    <body x-data="{
    code: '',
    ⦚ 6 unchanged lines ⦚
    this.startTimer();
    try {
    const payload = { code: this.code };
    const response = await fetchJSON('https://api.val.town/v1/eval', {
    method: 'POST',
    body: JSON.stringify(payload)
    });
    this.result = JSON.stringify(response, null, 2);
    ⦚ 22 unchanged lines ⦚
    placeholder="Enter code to evaluate"
    ></textarea>
    </div>
  • v15

    4/13/2024
    Open: Version
    Changes from v14 to v15
    +1
    -1
    ⦚ 74 unchanged lines ⦚
    });

    export default app;
    ⦚ 74 unchanged lines ⦚
    });

    export default app.fetch;
  • v14

    4/13/2024
    Open: Version
    Changes from v13 to v14
    +0
    -0
    ⦚ 77 unchanged lines ⦚
    ⦚ 77 unchanged lines ⦚
  • v13

    4/13/2024
    Open: Version
    Changes from v12 to v13
    +0
    -14
    ⦚ 11 unchanged lines ⦚
    <title>Val Town Eval Sandbox</title>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
    {/* <style>{`
    .loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    }
    @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
    }
    `}</style> */}
    </head>
    <body x-data="{
    code: '',
    ⦚ 61 unchanged lines ⦚
    ⦚ 11 unchanged lines ⦚
    <title>Val Town Eval Sandbox</title>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
    </head>
    <body x-data="{
    code: '',
    ⦚ 61 unchanged lines ⦚
  • v12

    4/13/2024
    Open: Version
    +91
    -0

    /** @jsxImportSource https://esm.sh/hono@3.1.3/jsx */
    import { Hono } from "https://deno.land/x/hono@v3.1.3/mod.ts";
    import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";

    const app = new Hono();

    // Server-side rendering
    app.get("/", async (c) => {
    const html = (
    <html>
    <head>
    <title>Val Town Eval Sandbox</title>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
    {/* <style>{`
    .loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    }
    @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
    }
    `}</style> */}
    </head>
    <body x-data="{
    code: '',
    result: '',
    isEvaluating: false,
    elapsedTime: 0,
    async evaluate() {
    this.isEvaluating = true;
    this.elapsedTime = 0;
yawnxyz-stringcoderunner.web.val.run
Updated: May 1, 2024