This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jsonResolver : D.Decoder a -> Http.Resolver Http.Error a | |
jsonResolver decoder = | |
Http.stringResolver <| | |
\response -> | |
case response of | |
Http.BadUrl_ url -> | |
Err (Http.BadUrl url) | |
Http.Timeout_ -> | |
Err Http.Timeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The good part: | |
// String(javaString).valueOf() | |
// Follow the same pattern to convert other Java types to corresponding JavaScript primitives | |
var javaString = new java.lang.String("test"); | |
print('javaString:', javaString); | |
print('typeof javaString:', typeof javaString); // Object | |
print('javaString instanceof String:', (javaString instanceof String)); // true (really a java.lang.String object) | |
print('String(javaString).valueOf() === "test":', String(javaString).valueOf() === "test"); // true: Converted to JS primitive |