From 2a53fe50c62d4b7aec0f422998c743f68aa523c1 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Tue, 21 Jul 2015 23:25:58 +0200 Subject: Adding the payment without reloading the page --- src/client/Native/Reads.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/client/Native/Reads.js (limited to 'src/client/Native') diff --git a/src/client/Native/Reads.js b/src/client/Native/Reads.js new file mode 100644 index 0000000..52590f9 --- /dev/null +++ b/src/client/Native/Reads.js @@ -0,0 +1,27 @@ +Elm.Native.Reads = {}; +Elm.Native.Reads.make = function(localRuntime) { + + localRuntime.Native = localRuntime.Native || {}; + localRuntime.Native.Reads = localRuntime.Native.Reads || {}; + if(localRuntime.Native.Reads.values) { + return localRuntime.Native.Reads.values; + } + + var Result = Elm.Result.make(localRuntime); + + function div(a, b) + { + return (a/b)|0; + } + + function readInt(str) { + var number = Number(str); + return isNaN(number) + ? Result.Err("unable to parse '" + str + "' as a number") + : Result.Ok(number); + } + + return localRuntime.Native.Reads.values = { + readInt: readInt + }; +}; -- cgit v1.2.3