Browser piggieback connection convenience
When you provide a port number, you are implicitly saying you're listening for a browser connection.
This commit is contained in:
parent
29af4adc46
commit
99d93ceba1
@ -40,7 +40,10 @@ properly, and that not all operations are supported.
|
|||||||
cemerick.piggieback/cljs-repl with the given or
|
cemerick.piggieback/cljs-repl with the given or
|
||||||
default (Rhino) environment. This will also happen
|
default (Rhino) environment. This will also happen
|
||||||
automatically on first eval in a ClojureScript buffer
|
automatically on first eval in a ClojureScript buffer
|
||||||
if not invoked explicitly.
|
if not invoked explicitly. If {env} is a number, the
|
||||||
|
piggieback repl-env will will use a cljs.repl.browser
|
||||||
|
(rather than a Rhino) env with the port set to the
|
||||||
|
number provided.
|
||||||
|
|
||||||
:Piggieback! Terminate the most recently created piggieback
|
:Piggieback! Terminate the most recently created piggieback
|
||||||
session.
|
session.
|
||||||
|
@ -212,12 +212,17 @@ function! s:repl.piggieback(arg, ...) abort
|
|||||||
endif
|
endif
|
||||||
return {}
|
return {}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let connection = s:conn_try(self.connection, 'clone')
|
||||||
if empty(a:arg)
|
if empty(a:arg)
|
||||||
let arg = ''
|
let arg = ''
|
||||||
|
elseif a:arg =~# '^\d\{1,5}$'
|
||||||
|
call connection.eval("(require 'cljs.repl.browser)")
|
||||||
|
let port = matchstr(a:arg, '^\d\{1,5}$')
|
||||||
|
let arg = ' :repl-env (cljs.repl.browser/repl-env :port '.port.')'
|
||||||
else
|
else
|
||||||
let arg = ' :repl-env ' . a:arg
|
let arg = ' :repl-env ' . a:arg
|
||||||
endif
|
endif
|
||||||
let connection = s:conn_try(self.connection, 'clone')
|
|
||||||
let response = connection.eval('(cemerick.piggieback/cljs-repl'.arg.')')
|
let response = connection.eval('(cemerick.piggieback/cljs-repl'.arg.')')
|
||||||
|
|
||||||
if empty(get(response, 'ex'))
|
if empty(get(response, 'ex'))
|
||||||
|
Loading…
Reference in New Issue
Block a user