-
Notifications
You must be signed in to change notification settings - Fork 11
add withDebuggerName #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ module Debugger = | |
let showWarning (msgs: obj list) = JS.console.warn("[ELMISH DEBUGGER]", List.toArray msgs) | ||
|
||
type ConnectionOptions = | ||
| ViaExtension | ||
| ViaExtension of name:string | ||
| Remote of address:string * port:int | ||
| Secure of address:string * port:int | ||
|
||
|
@@ -41,10 +41,11 @@ module Debugger = | |
hostname = "remotedev.io" | ||
port = 443 | ||
secure = true | ||
name = "Elmish" | ||
getActionType = Some getCase } | ||
|
||
match opt with | ||
| ViaExtension -> { fallback with remote = false; hostname = "localhost"; port = 8000; secure = false } | ||
| ViaExtension name -> { fallback with remote = false; hostname = "localhost"; port = 8000; secure = false ; name = name} | ||
| Remote (address,port) -> { fallback with hostname = address; port = port; secure = false } | ||
| Secure (address,port) -> { fallback with hostname = address; port = port } | ||
|> connectViaExtension | ||
|
@@ -137,7 +138,7 @@ module Program = | |
|
||
let inline withDebuggerCoders (encoder: Encoder<'model>) (decoder: Decoder<'model>) program : Program<'a,'model,'msg,'view> = | ||
let deflater, inflater = getTransformersWith encoder decoder | ||
let connection = Debugger.connect<'msg> Debugger.ViaExtension | ||
let connection = Debugger.connect<'msg> (Debugger.ViaExtension "Elmish") | ||
withDebuggerUsing deflater inflater connection program | ||
|
||
let inline withDebuggerAt options program : Program<'a,'model,'msg,'view> = | ||
|
@@ -148,12 +149,16 @@ module Program = | |
with ex -> | ||
Debugger.showError ["Unable to connect to the monitor, continuing w/o debugger"; ex.Message] | ||
program | ||
|
||
let inline withDebuggerName (name:string) (program : Program<'a,'model,'msg,'view>) : Program<'a,'model,'msg,'view> = | ||
try | ||
let deflater, inflater = getTransformers<'model>() | ||
let connection = Debugger.connect<'msg> (Debugger.ViaExtension name) | ||
withDebuggerUsing deflater inflater connection program | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the helper functions call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @et1975 Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also reduce the usage of the default name down to 1 place. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe it should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I was wondering about that, @OnurGumus is naming supported with remote debugger? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think not; but I am not sure. |
||
with ex -> | ||
Debugger.showError ["Unable to connect to the monitor, continuing w/o debugger"; ex.Message] | ||
program | ||
|
||
let inline withDebugger (program : Program<'a,'model,'msg,'view>) : Program<'a,'model,'msg,'view> = | ||
try | ||
let deflater, inflater = getTransformers<'model>() | ||
let connection = Debugger.connect<'msg> Debugger.ViaExtension | ||
withDebuggerUsing deflater inflater connection program | ||
with ex -> | ||
Debugger.showError ["Unable to connect to the monitor, continuing w/o debugger"; ex.Message] | ||
program | ||
withDebuggerName "Elmish" program | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic string "Elmish" used in several places. Here, L141, and L163. Would empty string be a better default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well one is for fallback the other is the default. I am not sure, what is best here though.