fable-react
Advanced tools
Comparing version 0.7.2 to 0.7.3
{ | ||
"name": "fable-react", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "Fable bindings and helpers for React and React Native", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -21,3 +21,3 @@ import { getTypeFullName } from "fable-core/Reflection"; | ||
function getModel(key) { | ||
function getModel(key, _genArgs) { | ||
return function (builder_) { | ||
@@ -27,3 +27,3 @@ return builder_.Delay(function () { | ||
return _arg1 == null ? builder_.Return([]) : builder_.Return(ofJson(_arg1, { | ||
T: _Array(GenericParam("a")) | ||
T: _Array(_genArgs.a) | ||
})); | ||
@@ -35,7 +35,9 @@ }); | ||
export function add(data) { | ||
var key = "models/" + getTypeFullName(GenericParam("a")); | ||
export function add(data, _genArgs) { | ||
var key = "models/" + getTypeFullName(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var newModel = toJson([data].concat(_arg1)); | ||
@@ -49,7 +51,9 @@ return builder_.Bind(awaitPromise(AsyncStorage.setItem(key, newModel)), function (_arg2) { | ||
} | ||
export function update(index, data) { | ||
var key = "models/" + getTypeFullName(GenericParam("a")); | ||
export function update(index, data, _genArgs) { | ||
var key = "models/" + getTypeFullName(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
_arg1[index] = data; | ||
@@ -65,7 +69,9 @@ var newModel = toJson(_arg1); | ||
function _delete(index) { | ||
var key = "models/" + getTypeFullName(GenericParam("a")); | ||
function _delete(index, _genArgs) { | ||
var key = "models/" + getTypeFullName(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var model = Array.from(mapIndexed(function (i, x) { | ||
@@ -88,7 +94,9 @@ return [i, x]; | ||
export { _delete as delete }; | ||
export function updateMultiple(values) { | ||
var key = "models/" + getTypeFullName(GenericParam("a")); | ||
export function updateMultiple(values, _genArgs) { | ||
var key = "models/" + getTypeFullName(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
return builder_.Combine(builder_.For(values, function (_arg2) { | ||
@@ -107,7 +115,9 @@ _arg1[_arg2[0]] = _arg2[1]; | ||
} | ||
export function updateWithFunction(updateF) { | ||
var key = "models/" + getTypeFullName(GenericParam("a")); | ||
export function updateWithFunction(updateF, _genArgs) { | ||
var key = "models/" + getTypeFullName(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var updated = updateF(_arg1); | ||
@@ -122,7 +132,9 @@ var newModel = toJson(updated); | ||
} | ||
export function updateWithFunctionAndKey(updateF, key) { | ||
var key_1 = "models/" + getTypeFullName(GenericParam("a")) + "/" + key; | ||
export function updateWithFunctionAndKey(updateF, key, _genArgs) { | ||
var key_1 = "models/" + getTypeFullName(_genArgs.a) + "/" + key; | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key_1), function (_arg1) { | ||
return builder_.Bind(getModel(key_1, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var updated = updateF(_arg1); | ||
@@ -137,7 +149,9 @@ var newModel = toJson(updated); | ||
} | ||
export function addMultiple(data) { | ||
var key = "models/" + getTypeFullName(GenericParam("a")); | ||
export function addMultiple(data, _genArgs) { | ||
var key = "models/" + getTypeFullName(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var newModel = toJson(data.concat(_arg1)); | ||
@@ -173,7 +187,9 @@ return builder_.Bind(awaitPromise(AsyncStorage.setItem(key, newModel)), function (_arg2) { | ||
} | ||
export function get(index) { | ||
var key = "models/" + getTypeFullName(GenericParam("a")); | ||
export function get(index, _genArgs) { | ||
var key = "models/" + getTypeFullName(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
return builder_.Return(_arg1[index]); | ||
@@ -184,15 +200,21 @@ }); | ||
} | ||
export function getAll() { | ||
var key = "models/" + getTypeFullName(GenericParam("a")); | ||
return getModel(key); | ||
export function getAll(_genArgs) { | ||
var key = "models/" + getTypeFullName(_genArgs.a); | ||
return getModel(key, { | ||
a: _genArgs.a | ||
}); | ||
} | ||
export function getAllWithKey(key) { | ||
var key_1 = "models/" + getTypeFullName(GenericParam("a")) + "/" + key; | ||
return getModel(key_1); | ||
export function getAllWithKey(key, _genArgs) { | ||
var key_1 = "models/" + getTypeFullName(_genArgs.a) + "/" + key; | ||
return getModel(key_1, { | ||
a: _genArgs.a | ||
}); | ||
} | ||
export function count() { | ||
var key = "models/" + getTypeFullName(GenericParam("a")); | ||
export function count(_genArgs) { | ||
var key = "models/" + getTypeFullName(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
return builder_.Return(_arg1.length); | ||
@@ -199,0 +221,0 @@ }); |
@@ -47,3 +47,3 @@ (function (global, factory) { | ||
function getModel(key) { | ||
function getModel(key, _genArgs) { | ||
return function (builder_) { | ||
@@ -53,3 +53,3 @@ return builder_.Delay(function () { | ||
return _arg1 == null ? builder_.Return([]) : builder_.Return((0, _Serialize.ofJson)(_arg1, { | ||
T: (0, _Util.Array)((0, _Util.GenericParam)("a")) | ||
T: (0, _Util.Array)(_genArgs.a) | ||
})); | ||
@@ -61,7 +61,9 @@ }); | ||
function add(data) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")); | ||
function add(data, _genArgs) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var newModel = (0, _Serialize.toJson)([data].concat(_arg1)); | ||
@@ -76,7 +78,9 @@ return builder_.Bind((0, _Async.awaitPromise)(_reactNative.AsyncStorage.setItem(key, newModel)), function (_arg2) { | ||
function update(index, data) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")); | ||
function update(index, data, _genArgs) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
_arg1[index] = data; | ||
@@ -92,7 +96,9 @@ var newModel = (0, _Serialize.toJson)(_arg1); | ||
function _delete(index) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")); | ||
function _delete(index, _genArgs) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var model = Array.from((0, _Seq.mapIndexed)(function (i, x) { | ||
@@ -116,7 +122,9 @@ return [i, x]; | ||
function updateMultiple(values) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")); | ||
function updateMultiple(values, _genArgs) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
return builder_.Combine(builder_.For(values, function (_arg2) { | ||
@@ -136,7 +144,9 @@ _arg1[_arg2[0]] = _arg2[1]; | ||
function updateWithFunction(updateF) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")); | ||
function updateWithFunction(updateF, _genArgs) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var updated = updateF(_arg1); | ||
@@ -152,7 +162,9 @@ var newModel = (0, _Serialize.toJson)(updated); | ||
function updateWithFunctionAndKey(updateF, key) { | ||
var key_1 = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")) + "/" + key; | ||
function updateWithFunctionAndKey(updateF, key, _genArgs) { | ||
var key_1 = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a) + "/" + key; | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key_1), function (_arg1) { | ||
return builder_.Bind(getModel(key_1, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var updated = updateF(_arg1); | ||
@@ -168,7 +180,9 @@ var newModel = (0, _Serialize.toJson)(updated); | ||
function addMultiple(data) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")); | ||
function addMultiple(data, _genArgs) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
var newModel = (0, _Serialize.toJson)(data.concat(_arg1)); | ||
@@ -207,7 +221,9 @@ return builder_.Bind((0, _Async.awaitPromise)(_reactNative.AsyncStorage.setItem(key, newModel)), function (_arg2) { | ||
function get(index) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")); | ||
function get(index, _genArgs) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
return builder_.Return(_arg1[index]); | ||
@@ -219,17 +235,23 @@ }); | ||
function getAll() { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")); | ||
return getModel(key); | ||
function getAll(_genArgs) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a); | ||
return getModel(key, { | ||
a: _genArgs.a | ||
}); | ||
} | ||
function getAllWithKey(key) { | ||
var key_1 = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")) + "/" + key; | ||
return getModel(key_1); | ||
function getAllWithKey(key, _genArgs) { | ||
var key_1 = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a) + "/" + key; | ||
return getModel(key_1, { | ||
a: _genArgs.a | ||
}); | ||
} | ||
function count() { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)((0, _Util.GenericParam)("a")); | ||
function count(_genArgs) { | ||
var key = "models/" + (0, _Reflection.getTypeFullName)(_genArgs.a); | ||
return function (builder_) { | ||
return builder_.Delay(function () { | ||
return builder_.Bind(getModel(key), function (_arg1) { | ||
return builder_.Bind(getModel(key, { | ||
a: _genArgs.a | ||
}), function (_arg1) { | ||
return builder_.Return(_arg1.length); | ||
@@ -236,0 +258,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2820563
1443