From 599f0aa18b2400eeef9c4a8f835e070607722974 Mon Sep 17 00:00:00 2001 From: Jens de Boer Date: Tue, 9 Oct 2018 19:07:40 +0200 Subject: [PATCH] The webview is now hidden until the request is finished - this removes the white flashing background at the start --- p5.js-screen-saver/p5_js_screen_saverView.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/p5.js-screen-saver/p5_js_screen_saverView.m b/p5.js-screen-saver/p5_js_screen_saverView.m index ed0226c..7692f4b 100644 --- a/p5.js-screen-saver/p5_js_screen_saverView.m +++ b/p5.js-screen-saver/p5_js_screen_saverView.m @@ -28,10 +28,20 @@ - (instancetype)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview webView.navigationDelegate = self; NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0]; [webView loadRequest:request]; + + // Hide webview while loading + [webView setHidden:true]; + [self addSubview:webView]; return self; } +// Show webview when finished loading +- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation; +{ + [webView setHidden:false]; +} + - (void)startAnimation { [super startAnimation];