github.com/gopherjs/gopherjs@v1.19.0-beta1.0.20240506212314-27071a8796e4/embed.go (about)

     1  // This file exists to embed the js/ and nosync/ directories. The "embed"
     2  // package only supports embedding files stored beneath the directory level
     3  // of the go:embed directive, so we do the embedding here, then inject the
     4  // fs reference to the gopherjspkg package, where it's used.  In the future we
     5  // may wish to refactor that, as the gopherjspkg package may not really be
     6  // necessary at all any more.
     7  
     8  package main
     9  
    10  import (
    11  	"embed"
    12  	"net/http"
    13  
    14  	"github.com/gopherjs/gopherjs/compiler/gopherjspkg"
    15  )
    16  
    17  //go:embed js nosync
    18  var fs embed.FS
    19  
    20  func init() {
    21  	gopherjspkg.RegisterFS(http.FS(fs))
    22  }