UNPKG

bucklescript-tea

Version:
118 lines (109 loc) 4.91 kB
// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE 'use strict'; var List = require("bs-platform/lib/js/list.js"); var Block = require("bs-platform/lib/js/block.js"); var Curry = require("bs-platform/lib/js/curry.js"); var Tea_app = require("../src-ocaml/tea_app.js"); var Tea_json = require("../src-ocaml/tea_json.js"); var Tea_html2 = require("../src-ocaml/tea_html2.js"); var Caml_format = require("bs-platform/lib/js/caml_format.js"); function set_value(param_0) { return /* Set_value */[param_0]; } function update(model, param) { if (param) { return param[0]; } else { return model + 1 | 0; } } function view(model) { var clientX = Tea_json.Decoder.field("clientX", Tea_json.Decoder.$$int); var init = Tea_html2.Events.defaultOptions; return Tea_html2.div(undefined, undefined, /* [] */0, List.map((function (e) { return Tea_html2.div(undefined, undefined, /* [] */0, /* :: */[ e, /* [] */0 ]); }), /* :: */[ /* Text */Block.__(1, [String(model)]), /* :: */[ Tea_html2.button(undefined, undefined, /* :: */[ Tea_html2.Events.onClick(/* Click */0), /* [] */0 ], /* :: */[ /* Text */Block.__(1, ["onClick"]), /* [] */0 ]), /* :: */[ Tea_html2.button(undefined, undefined, /* :: */[ Curry._3(Tea_html2.Events.on, "", "click", Tea_json.Decoder.succeed(/* Click */0)), /* [] */0 ], /* :: */[ /* Text */Block.__(1, ["on \"click\""]), /* [] */0 ]), /* :: */[ Tea_html2.a(undefined, undefined, /* :: */[ Tea_html2.Attributes.href("https://www.google.com"), /* [] */0 ], /* :: */[ /* Text */Block.__(1, ["a normal link"]), /* [] */0 ]), /* :: */[ Tea_html2.a(undefined, undefined, /* :: */[ Tea_html2.Attributes.href("https://www.google.com"), /* :: */[ Curry._4(Tea_html2.Events.onWithOptions, "", "click", { stopPropagation: init.stopPropagation, preventDefault: true }, Tea_json.Decoder.succeed(/* Click */0)), /* [] */0 ] ], /* :: */[ /* Text */Block.__(1, ["a link with prevent default"]), /* [] */0 ]), /* :: */[ Tea_html2.button(undefined, undefined, /* :: */[ Curry._3(Tea_html2.Events.on, "", "click", Tea_json.Decoder.map(set_value, clientX)), /* [] */0 ], /* :: */[ /* Text */Block.__(1, ["on \"click\", use clientX value"]), /* [] */0 ]), /* :: */[ Tea_html2.input$prime(undefined, undefined, /* :: */[ Tea_html2.Attributes.type$prime("text"), /* :: */[ Curry._3(Tea_html2.Events.on, "", "input", Tea_json.Decoder.map((function (v) { return /* Set_value */[Caml_format.caml_int_of_string(v)]; }), Tea_html2.Events.targetValue)), /* [] */0 ] ], /* [] */0), /* [] */0 ] ] ] ] ] ] ])); } var partial_arg = { model: 0, update: update, view: view }; function main(param, param$1) { return Tea_app.beginnerProgram(partial_arg, param, param$1); } var click = /* Click */0; exports.click = click; exports.set_value = set_value; exports.update = update; exports.view = view; exports.main = main; /* Tea_html2 Not a pure module */