소개
런타임은 애플리케이션에 유틸리티 메서드를 제공하는 라이브러리입니다. There is both a Go and JavaScript runtime and the aim is to try and keep them at parity where possible.
다음에 대한 유틸리티 메서드가 있습니다:
Go 런타임은 github.com/wailsapp/wails/v2/pkg/runtime 가져오기를 통해 사용할 수 있습니다. 이 패키지의 모든 메소드는 컨텍스트를 첫 번째 매개변수로 사용합니다. 이 컨텍스트는 OnStartup 또는 OnDomReady 후크에서 가져와야 합니다.
:::참고
컨텍스트는 OnStartup 메서드를 사용할 경우 런타임이 이 메서드에서 다음과 같이 작동할 것이라는 보장은 없습니다. 창이 다른 스레드에서 초기화되고 있습니다. 시작 시 런타임 메서드를 호출하려면 OnDomReady를 사용하세요.
:::
The JavaScript library is available to the frontend via the window.runtime map. There is a runtime package generated when using dev mode that provides TypeScript declarations for the runtime. 이것은 프론트엔드 디렉토리의 wailsjs 디렉토리에 있어야 합니다.