mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Use html5 storage to cache coffee script compilation by file md5
This commit is contained in:
@@ -106,7 +106,13 @@ __exists = (path) ->
|
||||
|
||||
__coffeeCache = (filePath) ->
|
||||
{CoffeeScript} = require 'coffee-script'
|
||||
CoffeeScript.compile(__read(filePath), filename: filePath)
|
||||
cacheKey = 'coffee.' + $native.md5ForPath(filePath)
|
||||
if compiled = localStorage.getItem(cacheKey)
|
||||
compiled
|
||||
else
|
||||
compiled = CoffeeScript.compile(__read(filePath), filename: filePath)
|
||||
localStorage.setItem(cacheKey, compiled)
|
||||
compiled
|
||||
|
||||
__read = (path) ->
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user