0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

elm-spa と electron でデスクトップアプリ作ろうとしたけど諦めた話

Posted at

elm-spa と electron でデスクトップアプリ作りたい

いい感じのアイディアを思いついたので Electron でデスクトップアプリを作りたいと思った

elm でデスクトップアプリを作れるなら楽しそう!と思ったりして Electron を触ってみたかったりして思い立ったが

今回は諦めました。。

諦めた理由

elm-spa で使用している Browser のライブラリとどうやら相性が悪そうで

elm-spa ではルーティングをうまくやってくれるのですがそこで使用している application で問題がありました。

application :
    { init : flags -> Url -> Key -> ( model, Cmd msg )
    , view : model -> Document msg
    , update : msg -> model -> ( model, Cmd msg )
    , subscriptions : model -> Sub msg
    , onUrlRequest : UrlRequest -> msg
    , onUrlChange : Url -> msg
    }
    -> Program flags model msg

application ないの Url という型の Protcol という型がどうやら、HttpHttps しか対応していないみたいです。

-- URL


{-| In [the URI spec](https://tools.ietf.org/html/rfc3986), Tim Berners-Lee
says a URL looks like this:

  https://example.com:8042/over/there?name=ferret#nose
  \___/   \______________/\_________/ \_________/ \__/
    |            |            |            |        |
  scheme     authority       path        query   fragment

When you are creating a single-page app with [`Browser.fullscreen`][fs], you
use the [`Url.Parser`](Url-Parser) module to turn a `Url` into even nicer data.
If you want to create your own URLs, check out the [`Url.Builder`](Url-Builder)
module as well!
[fs]: /packages/elm/browser/latest/Browser#fullscreen
**Note:** This is a subset of all the full possibilities listed in the URI
spec. Specifically, it does not accept the `userinfo` segment you see in email
addresses like `tom@example.com`.
-}
type alias Url =
  { protocol : Protocol
  , host : String
  , port_ : Maybe Int
  , path : String
  , query : Maybe String
  , fragment : Maybe String
  }

{-| Is the URL served over a secure connection or not?
-}
type Protocol = Http | Https

どうやら electron では file:/// というパスを参照しているみたいで
以下のようなエラーを吐きました

Browser.application ではその URL はハンドリングできないよって言ってます

Uncaught Error: Browser.application programs cannot handle URLs like this:

file:///xxxx/public/index.html

Github でも結構前からこの会話されてるみたいです。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?