templates

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

{{ .Name }}

File paths:

export WASM_FILE="./main.wasm"
export BINDINGS_FILE="./bindings.js"
export EMBEDDING_FILE="./embed.js"
export ZIP_FILE="./webext.zip"

Development

pcz dev webext ./ \
  --wasm "${WASM_FILE}" \
  --module-name "{{ .ModuleName }}" \
  --bindings "${BINDINGS_FILE}" \
  --embedding "${EMBEDDING_FILE}" \
  --embed "const wasmBlob=${WASM_FILE}" \
  --zip "${ZIP_FILE}"

Release

  1. Build and strip the wasm blob.

    pcz build ./ \
      -p js/wasm \
      -o "${WASM_FILE}" \
      --trimpath \
      -L-s \
      -L-w
    
  2. Generate bindings for the wasm.

    pcz dev webext bindgen ./ \
      -o "${BINDINGS_FILE}" \
      --wasm "${WASM_FILE}" \
      --module-system "umd" \
      --module-name "{{ .ModuleName }}" \
      --minify \
      --es 6
    
    mv "${BINDINGS_FILE}.min.js" "${BINDINGS_FILE}"
    
  3. Generate embedding for loading wasm synchronously

    pcz embed js \
      -o "${EMBEDDING_FILE}" \
      -f "const wasmBlob=${WASM_FILE}"
    
  4. Package the web extension

    # this example uses the default glob to match files
    pcz dev webext pack -o "./webext.zip"
    
  5. Distribute the web extension

Documentation

Overview

+ package main

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PopupPage

type PopupPage struct {
	// contains filtered or unexported fields
}

func (*PopupPage) Init

func (p *PopupPage) Init()

type ServiceWorker

type ServiceWorker struct {
	// contains filtered or unexported fields
}

func (*ServiceWorker) Init

func (w *ServiceWorker) Init()

type SettingsPage

type SettingsPage struct {
	// contains filtered or unexported fields
}

func (*SettingsPage) Init

func (p *SettingsPage) Init()

type SidePanel

type SidePanel struct {
	// contains filtered or unexported fields
}

func (*SidePanel) Init

func (p *SidePanel) Init()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL