Merge pull request #10 from profelis/development

setup default behaviour
This commit is contained in:
Dima Granetchi
2017-03-11 12:33:30 +02:00
committed by GitHub
9 changed files with 40 additions and 7 deletions
+11
View File
@@ -11,6 +11,7 @@
- neat API for subscribing to properties and methods changes - neat API for subscribing to properties and methods changes
- extended API for custom expressions binding - extended API for custom expressions binding
- API for fast properties binding - API for fast properties binding
- support `@:bindable` attribute in interfaces
====== ======
@@ -108,6 +109,16 @@ Log level | Description
====== ======
## Setup:
Define | Description | Default value
------------ | ------------- | -------------
`bindx_lazy_signal` | lazy signal initiazation. `-D bindx_lazy_signal=0` disable option | true
`bindx_inline_signal_getter` | inline signal getter | false
`bindx_inline_setter` | inline autogenerated setter | false
======
## Additional ## Additional
- BindExt and `this`. Use `this.bindableA.bindableB` to listen changes of `bindableA`, not only `bindableB` - BindExt and `this`. Use `this.bindableA.bindableB` to listen changes of `bindableA`, not only `bindableB`
+11
View File
@@ -11,6 +11,7 @@
- удобное API для подписки на изменения свойств или методов класса, - удобное API для подписки на изменения свойств или методов класса,
- расширенное API для связывания произвольного выражения, - расширенное API для связывания произвольного выражения,
- API для быстрого связывания свойств - API для быстрого связывания свойств
- поддержка и валидация `@:bindable` аттрибутов в интерфейсах
====== ======
@@ -108,6 +109,16 @@ Log level | Description
====== ======
## Настройка:
Define | Description | Default value
------------ | ------------- | -------------
`bindx_lazy_signal` | инициализация сигналов по требованию. `-D bindx_lazy_signal=0` выключает опцию | true
`bindx_inline_signal_getter` | геттер сигнала инлайнить | false
`bindx_inline_setter` | инлайнить ли автоматически сгенерированные сеттеры | false
======
## Дополнительно ## Дополнительно
- BindExt и `this`. Используйте `this.bindableA.bindableB` если необходимо слушать изменения `bindableA`, а не только `bindableB` - BindExt и `this`. Используйте `this.bindableA.bindableB` если необходимо слушать изменения `bindableA`, а не только `bindableB`
+1
View File
@@ -0,0 +1 @@
-D bindx_lazy_signal=1
+2 -2
View File
@@ -5,8 +5,8 @@
"tags": ["bind", "binding", "bindings", "cross"], "tags": ["bind", "binding", "bindings", "cross"],
"description": "Powerful and fast macro-based data binding engine inspired by Flex Bindings with easy-to-use syntax.", "description": "Powerful and fast macro-based data binding engine inspired by Flex Bindings with easy-to-use syntax.",
"classPath": "src", "classPath": "src",
"version": "2.6.0", "version": "2.6.1",
"releasenote": "log catched errors, haxe 3.4 support", "releasenote": "more options to setup library behaviour",
"contributors": [ "contributors": [
"deep" "deep"
] ]
+8 -2
View File
@@ -15,10 +15,12 @@ class BindSignalProvider implements IBindingSignalProvider {
* default value: true * default value: true
*/ */
static inline var LAZY_SIGNAL = "lazySignal"; static inline var LAZY_SIGNAL = "lazySignal";
static inline var DEFAULT_LAZY_SIGNAL = #if (bindx_lazy_signal > 0) true; #else false; #end
/** /**
* default value: false * default value: false
*/ */
static inline var INLINE_SIGNAL_GETTER = "inlineSignalGetter"; static inline var INLINE_SIGNAL_GETTER = "inlineSignalGetter";
static inline var DEFAULT_INLINE_SIGNAL_GETTER = #if (bindx_inline_signal_getter > 0) true; #else false; #end
public function new() {} public function new() {}
@@ -126,7 +128,7 @@ class BindSignalProvider implements IBindingSignalProvider {
return $i{signalPrivateName}; return $i{signalPrivateName};
}; };
var getterAccess = [APrivate]; var getterAccess = [APrivate];
if (inlineSignalGetter.isNotNullAndTrue()) getterAccess.push(AInline); if (hasInlineSignalGetter(inlineSignalGetter)) getterAccess.push(AInline);
res.push({ res.push({
name: signalGetterName(field.name), name: signalGetterName(field.name),
@@ -162,7 +164,11 @@ class BindSignalProvider implements IBindingSignalProvider {
} }
} }
@:extern inline function hasInlineSignalGetter(param:Expr):Bool {
return if (DEFAULT_INLINE_SIGNAL_GETTER) param.isNullOrTrue(); else param.isNotNullAndTrue();
}
@:extern inline function hasLazy(meta:MetadataEntry):Bool { @:extern inline function hasLazy(meta:MetadataEntry):Bool {
return meta.findParam(LAZY_SIGNAL).isNullOrTrue(); return if (DEFAULT_LAZY_SIGNAL) meta.findParam(LAZY_SIGNAL).isNullOrTrue(); else meta.findParam(LAZY_SIGNAL).isNotNullAndTrue();
} }
} }
+3 -2
View File
@@ -18,7 +18,8 @@ class BindableMacros {
/** /**
* default value: false * default value: false
*/ */
static public inline var INLINE_SETTER = "inlineSetter"; static inline var INLINE_SETTER = "inlineSetter";
static inline var DEFAULT_INLINE_SETTER = #if (bindx_inline_setter > 0) true; #else false; #end
/** /**
* default value: false * default value: false
*/ */
@@ -139,7 +140,7 @@ class BindableMacros {
return value; return value;
}; };
var setterAccess = [APrivate]; var setterAccess = [APrivate];
if (inlineSetter.isNotNullAndTrue()) setterAccess.push(AInline); if (DEFAULT_INLINE_SETTER ? inlineSetter.isNullOrTrue() : inlineSetter.isNotNullAndTrue()) setterAccess.push(AInline);
res.push({ res.push({
name: setterName, name: setterName,
kind: FFun(switch (setter.expr) { case EFunction (_, func): func; case _: throw false; }), kind: FFun(switch (setter.expr) { case EFunction (_, func): func; case _: throw false; }),
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
zip -r haxelib.zip src haxelib.json README.md LICENSE rm -f haxelib.zip
zip -r haxelib.zip src haxelib.json README.md LICENSE extraParams.hx
haxelib submit haxelib.zip haxelib submit haxelib.zip
+1
View File
@@ -4,3 +4,4 @@
-D dump=pretty -D dump=pretty
--interp --interp
-lib buddy -lib buddy
-D bindx_lazy_signal
+1
View File
@@ -2,3 +2,4 @@
-cp src -cp src
-cp test -cp test
-lib buddy -lib buddy
-D bindx_lazy_signal