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
module Base64 exposing (Base64ImgUrl, decoderStringToBase64ImgUrl, fromString, toString) | |
import Json.Decode as JD | |
import String exposing (startsWith) | |
type Base64ImgUrl | |
= Base64ImgUrl String | |
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
{ | |
"name": "elm-webinar-2", | |
"version": "1.0.0", | |
"description": "", | |
"main": "src/index.js", | |
"scripts": { | |
"clean": "rm dist/bundle.js", | |
"start": "parcel src/index.html", | |
"build-prod": "parcel build src/index.html" | |
}, |
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
npm install -g parcel-bundler | |
npm init -y |
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
-- наш чекбокс (стандартный input type="checkbox") | |
checkbox : (Bool -> msg) -> Bool -> Html msg | |
checkbox toMsg isChecked = | |
input | |
[ type_ "checkbox" | |
, checked isChecked | |
, onCheck toMsg | |
] | |
[] | |
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
-- было | |
viewHeader : Model -> Html Msg | |
viewHeader model = | |
...127 lines | |
viewBody : Model -> Html Msg | |
viewBody model = | |
...349 lines |
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
type Model | |
= Не_запрашивали | |
| В_процессе | |
| Получено (Ошибка или Новости) | |
-- в переводе на англ | |
type Model | |
= NotAsked | |
| Loading |
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
initialState = { | |
data: [], | |
isLoading: false, | |
error: null, | |
} |
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
<!-- ... --> | |
<script src="/elm.js"></script> | |
<script> | |
const errorLogger = error => console.error(`App Error: ${error}`); | |
const node = document.querySelector('#app'); | |
// add flags here | |
const flags = {} | |
try { | |
const app = Elm.Main.init({ node, flags }); |
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
// пример custom web component | |
// который добавляет на страницу fabric.js (canvas) элемент | |
class CustomCanvas extends HTMLElement { | |
constructor() { | |
const self = super(); | |
self._canvas = null; | |
self._ctx = null; | |
self._cf = null; // cf = canvas fabric instance | |
return self; |
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
-- Main.elm -> добавляем "port" | |
port module Main exposing (main) | |
-- ... | |
-- добавляем команду | |
port sendDataToJs : String -> Cmd msg | |
-- update функция | |
case msg of |
NewerOlder