Load fuzzy finder paths in web worker at startup

Previously the paths were first loaded when the fuzzy finder
view was first attached.

Now a web worker is started when the package activates that
sets the paths on the fuzzy finder view the first time it
displays if the worker has completed by the time an event occurs
that displays the view.
This commit is contained in:
Kevin Sawicki
2013-02-02 12:47:46 -08:00
parent a3b95a923d
commit 5cd3c04702
6 changed files with 79 additions and 36 deletions

View File

@@ -1,4 +1,3 @@
$ = require 'jquery'
_ = require 'underscore'
Subscriber = require 'subscriber'
GitRepository = require 'git-repository'
@@ -6,9 +5,9 @@ GitRepository = require 'git-repository'
module.exports =
class Git
@open: (path) ->
@open: (path, options) ->
try
new Git(path)
new Git(path, options)
catch e
null
@@ -24,9 +23,12 @@ class Git
working_dir_typechange: 1 << 10
ignore: 1 << 14
constructor: (path) ->
constructor: (path, options={}) ->
@repo = new GitRepository(path)
@subscribe $(window), 'focus', => @refreshIndex()
refreshIndexOnFocus = options.refreshIndexOnFocus ? true
if refreshIndexOnFocus
$ = require 'jquery'
@subscribe $(window), 'focus', => @refreshIndex()
getRepo: ->
unless @repo?