/purescript-chrome

Purescript bindings for the chrome extension api

Primary LanguagePureScript

purescript-chrome

Purescript bindings for the Chrome extenstion APIs.

Currently Supported Methods

  • Tabs
    • chrome.tabs.get
    • chrome.tabs.getCurrent
    • chrome.tabs.getAllInWindow
    • chrome.tabs.query
  • History
    • chrome.history.search
    • chrome.history.getVisits
    • chrome.history.addUrl
    • chrome.history.deleteUrl
    • chrome.hisotry.deleteAll

Upcoming Support

Quick Start

This logs the 1st tab in the current window, if it exists.

module Main where

import Prelude
import Chrome.Tabs (getTab)
import Data.Maybe
import Effect.Class.Console
import Effect.Aff (launchAff_)

main :: Effect Unit
main = launchAff_ do
    currentTab <- getTab 1
    case currentTab of
        Just tab -> liftEffect $ log tab.url
        Nothing -> pure unit

Runs when extension is clicked and default popup opens. Log will be visible on inspecting the popup element