github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/protocol/gui-page.go (about) 1 /* For license and copyright information please see LEGAL file in repository */ 2 3 package protocol 4 5 type GUIPages interface { 6 RegisterPage(page GUIPage) 7 GetPageByPath(path string) (page GUIPage) 8 Pages() (pages []GUIPage) 9 } 10 11 // GUIPage indicate what is a GUI page. 12 type GUIPage interface { 13 Robots() string 14 Icon() Image 15 Info() GUIInformation // It is locale info 16 // think about a page that show a user medical records, doctor need to know user birthday, so /user page must ready to reach by doctor 17 // or doctor need to know other doctors visits to know any advice from them for this user. 18 RelatedPages() []GUIPage 19 20 Path() string // To route page by path of HTTP-URI 21 AcceptedCondition(key string) (defaultValue any) // HTTP-URI queries 22 23 ActiveState() GUIPageState 24 ActiveStates() []GUIPageState 25 26 // Below methods are custom methods that must implement in each page not gui library. 27 28 // CreateState build the page in the requested state or reuse old states with SafeToSilentClose() 29 CreateState(url string) GUIPageState 30 31 // it is raw version of the page DOM. suggest to write HTML in a dedicated html file and have compile-time parser. 32 // - Due to multi page state mechanism and separate concern(content vs logic), don't support inline event handlers in HTML files 33 // dom() DOM 34 // it is raw version of the page SOM 35 // som() SOM 36 // it is raw version of the page templates DOM e.g. products-template-card.html 37 // template(name string) DOM 38 39 MediaType 40 }