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
- extended API for custom expressions 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
- 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 для быстрого связывания свойств
- поддержка и валидация `@: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`
+1
View File
@@ -0,0 +1 @@
-D bindx_lazy_signal=1
+2 -2
View File
@@ -5,8 +5,8 @@
"tags": ["bind", "binding", "bindings", "cross"],
"description": "Powerful and fast macro-based data binding engine inspired by Flex Bindings with easy-to-use syntax.",
"classPath": "src",
"version": "2.6.0",
"releasenote": "log catched errors, haxe 3.4 support",
"version": "2.6.1",
"releasenote": "more options to setup library behaviour",
"contributors": [
"deep"
]
+8 -2
View File
@@ -15,10 +15,12 @@ class BindSignalProvider implements IBindingSignalProvider {
* default value: true
*/
static inline var LAZY_SIGNAL = "lazySignal";
static inline var DEFAULT_LAZY_SIGNAL = #if (bindx_lazy_signal > 0) true; #else false; #end
/**
* default value: false
*/
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() {}
@@ -126,7 +128,7 @@ class BindSignalProvider implements IBindingSignalProvider {
return $i{signalPrivateName};
};
var getterAccess = [APrivate];
if (inlineSignalGetter.isNotNullAndTrue()) getterAccess.push(AInline);
if (hasInlineSignalGetter(inlineSignalGetter)) getterAccess.push(AInline);
res.push({
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 {
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
*/
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
*/
@@ -139,7 +140,7 @@ class BindableMacros {
return value;
};
var setterAccess = [APrivate];
if (inlineSetter.isNotNullAndTrue()) setterAccess.push(AInline);
if (DEFAULT_INLINE_SETTER ? inlineSetter.isNullOrTrue() : inlineSetter.isNotNullAndTrue()) setterAccess.push(AInline);
res.push({
name: setterName,
kind: FFun(switch (setter.expr) { case EFunction (_, func): func; case _: throw false; }),
+2 -1
View File
@@ -1,4 +1,5 @@
#!/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
+1
View File
@@ -4,3 +4,4 @@
-D dump=pretty
--interp
-lib buddy
-D bindx_lazy_signal
+1
View File
@@ -2,3 +2,4 @@
-cp src
-cp test
-lib buddy
-D bindx_lazy_signal