diff options
author | Joris Guyonvarch | 2015-07-21 23:25:58 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-07-21 23:25:58 +0200 |
commit | 2a53fe50c62d4b7aec0f422998c743f68aa523c1 (patch) | |
tree | ad32464c99668b477c4006146ec218c947bc9c8f /src/client/Native | |
parent | a271d6034bc4cc631a64476d25d21c83a701fa39 (diff) |
Adding the payment without reloading the page
Diffstat (limited to 'src/client/Native')
-rw-r--r-- | src/client/Native/Reads.js | 27 |
1 files changed, 27 insertions, 0 deletions
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 + }; +}; |