Giter Site home page Giter Site logo

elm-dropzone's People

Contributors

danyx23 avatar dawehner avatar minibill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

elm-dropzone's Issues

Tag `DropZone.Drop` is causing problems in this pattern match

I'm trying to setup elm-dropzone as described in the README, but pattern matching the action fails with:

-- TYPE MISMATCH -------------------------------------------------- ././Home.elm

Tag `DropZone.Drop` is causing problems in this pattern match.

28โ”‚         DnDAction (Drop files) ->
                       ^^^^^^^^^^
This pattern matches things of type:

    DropZone.Action

But the values it will actually be trying to match are:

    DropZone.Action a

I'm on Elm 0.16 and dropzone 1.0.1.

-- ...
import DropZone exposing (..)
-- ...

type alias Model =
    { dropzone : DropZone.Model, fileUrl : String }

type Action
    = DnDAction DropZone.Action
    | Load (Maybe String)
    | Reset

init : Model
init =
    { dropzone = DropZone.init, fileUrl = "" }

update : Action -> Model -> (Model, Effects Action)
update action model =
    case action of
        DnDAction (Drop files) ->
            let firstFile = List.head files
            in ( { model
              | dropzone = DropZone.update (Drop files) model.dropzone
              }
            , case firstFile of
                Nothing -> Effects.none
                Just file ->
                    file.blob
                    |> readAsTextFile
                    |> Task.toMaybe
                    |> Task.map Load
                    |> Effects.task
            )
        DnDAction act ->
            -- These are the other DropZone actions that are not exposed,
            -- but you still need to hand it to DropZone.update so
            -- the DropZone model stays consistent
            ( { model | dropzone = DropZone.update act model.dropzone }
            , Effects.none
            )
        Reset ->
            ({ model | fileUrl = "" }, Effects.none)

Update to Elm 0.18?

This looks like a cool library. I think it would be cool to update this to the latest version of Elm (if possible). Don't feel pressured to do it immediately, I'm just making an issue to track this.

Error running the example

I cannot find find module 'FileReader'.

Module 'Main' is trying to import it.

Potential problems could be:
  * Misspelled the module name
  * Need to add a source directory or new dependency to elm-package.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.