Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Peihl committed Oct 12, 2016
1 parent a674679 commit ed0553b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@ A simple Mapbox-GL.js app demonstrating how to use Turf.js with web workers to r
## Why?
Turf.js is great for doing small geoprocessing jobs in the browser. However, with larger jobs, it can freeze the browser for long periods. While the browser is waiting for the Turf process to complete, you can't pan or zoom on the map or even switch browser tabs.

With web workers we can move the geoprocessing job off the main UI thread. This means we can still manipulate the map and switch browser tabs while we wait for the job to complete.

Notice below how we can pan and zoom on the map while the Turf process is running in the background.

![turf-async](turf-async.gif)


In the GIF below the Turf process is run on the main UI thread which freezes the browser until the Turf job is complete. While only a couple of seconds, this diminishes the user's experience. A larger job could freeze the user's browser for a long time and ruin the effect for the user.

![turf-sync](turf-sync.gif)
With web workers we can move the geoprocessing job off the main user interface thread. This means we can still manipulate the map and switch browser tabs while we wait for the job to complete.

[Demo](https://nickpeihl.github.io/turf-async)

Notice how the dance party stops momentarily when we click the Turf Sync button? Don't let the dance party stop! Click the Turf Async button to run the process in a web worker. This frees up the user interface resources for the dance party to continue!
Binary file removed turf-async.gif
Binary file not shown.
Binary file removed turf-sync.gif
Binary file not shown.

0 comments on commit ed0553b

Please sign in to comment.