Skip to content

Instantly share code, notes, and snippets.

#meta

og = {}

function og.fetch(url) 
  local response = http.request(url)
  if response.ok then
    local parser = js.new(js.window.DOMParser)
    local document = parser.parseFromString(response.body, "text/html")

SB Notifications

Implementation

notification = {}

function notification.currentPermission()
  -- static properties seem to be inaccessible with js.window translation
  return js.window.eval("Notification.permission")
end

#meta

command.define {
  name = "Page: Rename Leaf",
  run = function()
    local page_name = editor.getCurrentPage()
    local l_start, l_end = page_name:find("[^/]+$")
    local path = page_name:sub(1, l_start - 1)
    local old_name = page_name:sub(l_start, l_end)