• Operand
  • can sell console.

gram:panel

> ./src/page.gleam

Lenses
(coming soon!)


import gleam/result
import gleam/javascript/array
import plinth/javascript/console
import plinth/browser/window
import plinth/browser/document.{query_selector_all}
import plinth/browser/element.{get_attribute, inner_text}

pub type Link {
  Link(label: String, address: String)
}

pub fn main() {
  console.log("running in: " <> window.location())

    query_selector_all("a") |> array.map(fn(a) { Link(
      a |> inner_text(),
      a |> get_attribute("href") |> result.lazy_unwrap(fn () { "" })
      ) }) |> console.log
}