Skip to content

Commit

Permalink
The webview is now hidden until the request is finished - this remove…
Browse files Browse the repository at this point in the history
…s the white flashing background at the start
  • Loading branch information
jnsdbr committed Oct 9, 2018
1 parent 70040e1 commit 599f0aa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions p5.js-screen-saver/p5_js_screen_saverView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 599f0aa

Please sign in to comment.