Socket
Socket
Sign inDemoInstall

@verygoodgraphics/vgg-react

Package Overview
Dependencies
6
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @verygoodgraphics/vgg-react

## Usage


Version published
Weekly downloads
4
increased by33.33%
Maintainers
3
Install size
4.83 MB
Created
Weekly downloads
 

Readme

Source

VGG React

Usage

<VGGRender />

import { VGGRender } from "@verygoodgraphics/vgg-react"

return (
  <VGGRender
    src="https://s3.vgg.cool/test/vgg.daruma"
    canvasStyle={{
      width: "50vw",
      height: "100vh",
    }}
    onLoad={async (_, instance) => {
      instance.$("2:94").on(EventType.Click, async () => {
        window.alert("Hello, VGG!")
      })
    }}
  />
)

useVGG()

import { useVGG } from "@verygoodgraphics/vgg-react"

const { canvasRef, vgg, isLoading } = useVGG({
  src: "https://s3.vgg.cool/test/vgg.daruma",
})

useEffect(() => {
  if (isLoading || !vgg.current) return
  vgg.current?.$("2:94").on(EventType.Click, async () => {
    window.alert("Hello, VGG!")
  })
}, [isLoading])

return (
  <canvas
    ref={canvasRef}
    style={{
      width: "50vw",
      height: "100vh",
    }}
  />
)

API

Options for useVGG()

OptionTypeRequiredDefault
srcstring--
runtimestring-https://s5.vgg.cool/runtime/latest
editModeboolean-false
verboseboolean-false
onLoadEventCallback--
onLoadErrorEventCallback--
onStateChangeEventCallback--

Props for <VGGRender />

OptionTypeRequiredDefault
srcstring--
runtimestring-https://s5.vgg.cool/runtime/latest
canvasStyleReact.CSSProperties--
editModeboolean-false
verboseboolean-false
onLoad(event: VGGEvent, instance: VGG<T>) => Promise<void>--
onLoadError(event: VGGEvent) => Promise<void>--
onStateChange(event: VGGEvent, instance: VGG<T>) => Promise<void>--

FAQs

Last updated on 14 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc