import { debug } from "../utils/debug" ; const pkg_name = process . env . PKG_NAME as string ; const version = process . env . PKG_VERSION as string ; export const spanId = "substrateExtension" ; export class ExtensionPageInjector { constructor ( ) { debug ( "SETTING UP INJECTOR" ) ; window . document . addEventListener ( "readystatechange" , ( ) => { debug ( "READYSTATE CHANGED" ) ; if ( window . document . readyState === "interactive" ) { this . inject ( ) ; } } ) ; } inject ( ) { debug ( "INJECTING EXTENSION SPAN" , spanId ) ; const s = document . createElement ( "span" ) ; s . id = spanId ; s . setAttribute ( "name" , pkg_name ) ; s . setAttribute ( "version" , version ) ; document . body . appendChild ( s ) ; } }