From e718a56ed98317b8d7d43a8fec988c4dd57104c4 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Mon, 27 May 2019 18:43:33 +1000 Subject: [PATCH 1/2] docs: updated contributors --- CONTRIBUTORS.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 6147eaf34..3c31a2b74 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -8,5 +8,6 @@ Wails is what it is because of the time and effort given by these great people. * [Adrian Lanzafame](https://github.com/lanzafame) * [0xflotus](https://github.com/0xflotus) * [Michael D Henderson](https://github.com/mdhender) -* [fred2104] (https://github.com/fishfishfish2104) -* [intelwalk] (https://github.com/intelwalk) +* [fred2104](https://github.com/fishfishfish2104) +* [intelwalk](https://github.com/intelwalk) +* [Mark Stenglein](https://github.com/ocelotsloth) From f4e6c407bae1d604db487595c543849f5a195a12 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 30 May 2019 08:43:26 +1000 Subject: [PATCH 2/2] chore: remove old JS/CSS api --- app.go | 23 ----------------------- renderer.go | 4 ---- renderer_headless.go | 16 ---------------- renderer_webview.go | 42 +++++++----------------------------------- 4 files changed, 7 insertions(+), 78 deletions(-) diff --git a/app.go b/app.go index 050e7a4b1..895c1501f 100644 --- a/app.go +++ b/app.go @@ -22,11 +22,6 @@ type App struct { bindingManager *bindingManager // Handles binding of Go code to renderer eventManager *eventManager // Handles all the events runtime *Runtime // The runtime object for registered structs - - // This is a list of all the JS/CSS that needs injecting - // It will get injected in order - jsCache []string - cssCache []string } // CreateApp creates the application window with the given configuration @@ -111,12 +106,6 @@ func (a *App) start() error { return err } - // Inject CSS - a.renderer.AddCSSList(a.cssCache) - - // Inject JS - a.renderer.AddJSList(a.jsCache) - // Run the renderer return a.renderer.Run() } @@ -126,15 +115,3 @@ func (a *App) start() error { func (a *App) Bind(object interface{}) { a.bindingManager.bind(object) } - -// AddJS adds a piece of Javascript to a cache that -// gets injected at runtime -func (a *App) AddJS(js string) { - a.jsCache = append(a.jsCache, js) -} - -// AddCSS adds a CSS string to a cache that -// gets injected at runtime -func (a *App) AddCSS(js string) { - a.cssCache = append(a.cssCache, js) -} diff --git a/renderer.go b/renderer.go index f9ba91524..f12c0c6fa 100644 --- a/renderer.go +++ b/renderer.go @@ -12,10 +12,6 @@ type Renderer interface { // Events NotifyEvent(eventData *eventData) error - // Injection - AddJSList(js []string) - AddCSSList(css []string) - // Dialog Runtime SelectFile() string SelectDirectory() string diff --git a/renderer_headless.go b/renderer_headless.go index ae9c1b240..f470eddbd 100644 --- a/renderer_headless.go +++ b/renderer_headless.go @@ -37,10 +37,6 @@ type Headless struct { appConfig *AppConfig eventManager *eventManager bindingCache []string - frameworkJS string - frameworkCSS string - jsCache []string - cssCache []string // Headless specific initialisationJS []string @@ -190,18 +186,6 @@ func (h *Headless) SelectSaveFile() string { return "" } -// AddJSList adds a slice of JS strings to the list of js -// files injected at startup -func (h *Headless) AddJSList(jsCache []string) { - h.jsCache = jsCache -} - -// AddCSSList adds a slice of CSS strings to the list of css -// files injected at startup -func (h *Headless) AddCSSList(cssCache []string) { - h.cssCache = cssCache -} - // Callback sends a callback to the frontend func (h *Headless) Callback(data string) error { return h.evalJS(data, callbackMessage) diff --git a/renderer_webview.go b/renderer_webview.go index d71d2f5d7..a3478d033 100644 --- a/renderer_webview.go +++ b/renderer_webview.go @@ -21,13 +21,6 @@ type webViewRenderer struct { config *AppConfig eventManager *eventManager bindingCache []string - frameworkJS string - frameworkCSS string - - // This is a list of all the JS/CSS that needs injecting - // It will get injected in order - jsCache []string - cssCache []string } // Initialise sets up the WebView @@ -175,13 +168,13 @@ func (w *webViewRenderer) Run() error { w.evalJSSync(binding) } - // Inject Framework - if w.frameworkJS != "" { - w.evalJSSync(w.frameworkJS) - } - if w.frameworkCSS != "" { - w.injectCSS(w.frameworkCSS) - } + // // Inject Framework + // if w.frameworkJS != "" { + // w.evalJSSync(w.frameworkJS) + // } + // if w.frameworkCSS != "" { + // w.injectCSS(w.frameworkCSS) + // } // Inject user CSS if w.config.CSS != "" { @@ -199,16 +192,6 @@ func (w *webViewRenderer) Run() error { w.injectCSS(defaultCSS) } - // Inject all the CSS files that have been added - for _, css := range w.cssCache { - w.injectCSS(css) - } - - // Inject all the JS files that have been added - for _, js := range w.jsCache { - w.evalJSSync(js) - } - // Inject user JS if w.config.JS != "" { outputJS := fmt.Sprintf("%.45s", w.config.JS) @@ -289,17 +272,6 @@ func (w *webViewRenderer) SelectSaveFile() string { return result } -// AddJS adds a piece of Javascript to a cache that -// gets injected at runtime -func (w *webViewRenderer) AddJSList(jsCache []string) { - w.jsCache = jsCache -} - -// AddCSSList sets the cssCache to the given list of strings -func (w *webViewRenderer) AddCSSList(cssCache []string) { - w.cssCache = cssCache -} - // Callback sends a callback to the frontend func (w *webViewRenderer) Callback(data string) error { callbackCMD := fmt.Sprintf("window.wails._.callback('%s');", data)