{"id":22469371,"url":"https://github.com/profelis/bindx2","last_synced_at":"2026-01-07T11:04:48.076Z","repository":{"id":16259063,"uuid":"19007131","full_name":"profelis/bindx2","owner":"profelis","description":"Crossplatform library for data binding in Haxe","archived":false,"fork":false,"pushed_at":"2019-11-15T20:25:26.000Z","size":186,"stargazers_count":49,"open_issues_count":0,"forks_count":7,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-03T07:17:43.255Z","etag":null,"topics":["binding","bindings","haxe"],"latest_commit_sha":null,"homepage":"","language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/profelis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-21T21:10:41.000Z","updated_at":"2020-08-23T08:32:21.000Z","dependencies_parsed_at":"2022-09-10T17:21:50.911Z","dependency_job_id":null,"html_url":"https://github.com/profelis/bindx2","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profelis%2Fbindx2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profelis%2Fbindx2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profelis%2Fbindx2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profelis%2Fbindx2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/profelis","download_url":"https://codeload.github.com/profelis/bindx2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245878924,"owners_count":20687297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binding","bindings","haxe"],"created_at":"2024-12-06T11:28:46.207Z","updated_at":"2026-01-07T11:04:48.071Z","avatar_url":"https://github.com/profelis.png","language":"Haxe","readme":"## bindx2 - crossplatform library for data binding in Haxe.\n\n[![Build Status](https://travis-ci.org/profelis/bindx2.svg?branch=master)](https://travis-ci.org/profelis/bindx2)\n\n======\n\n## Features:\n\n- automatically generates signals to notify about properties/methods changes of a class\n- automatically generates setters or modifies existing setters\n- neat API for subscribing to properties and methods changes\n- extended API for custom expressions binding\n- API for fast properties binding\n- support `@:bindable` attribute in interfaces\n\n======\n\n## Examples:\n\n```haxe\n// UserModel.hx\n\nimport bindx.IBindable;\n\n@:bindable\nclass UserModel implements IBindable\n{\n    public var name:String;\n    public var coins:Int;\n\n    public var health:Float = 1;\n\n    public function new(name:String, coins:Int) {\n        this.name = name;\n        this.coins = coins;\n    }\n}\n```\n...\n```haxe\n// bind complex expression with another field\nunbindOldUser = BindExt.exprTo('Hello ${user.name}. You have ' + user.coins + \" coins\", this.textField.text);\n\n// listen field changes\nBind.bind(user.health, onHealthChange);\n\nfunction onHealthChange(from:Null\u003cFloat\u003e, to:Null\u003cFloat\u003e) {\n    trace('user health changed from $from to $to');\n}\n```\n\n[All examples](https://github.com/profelis/bindx2/tree/master/samples/)\n\n======\n\n## API:\n\nMethod       | Description\n------------ | -------------\nBind.bind(expr, listener) | executes `listener` if property or method in `expr` was changed. If `expr` contains property, then `listener` accepts 2 arguments: old and new values. If `expr` contains method, `listener` accepts no arguments. Use `Bind.unbind` for unbind\nBind.bindTo(expr, toExpr) | Assign result of `expr` to `toExpr` (NB: if `expr` contains method, then this method will be executed without arguments!). Does NOT invoke `expr` automatically. Returns reference callback, which can be used to unbind.\nBind.notify(expr, oldValue, newValue) | Manually execute notification about property or method changes (if `expr` is method, then `oldValue` and `newValue` are not required)\nBind.unbind(expr, listener) | Unsubscribe provided `listener` from `expr` changes (NB: if `listener` is not specified, all listeners for binded to this `expr` will be unsubscribed)\nBind.bindAll(obj:IBindable, listener, force) | `listener(name:String, oldValue:Dynamic, newValue:Dynamic):Void` Bind all properties and methods of `obj` (force mode instantiate all lazy signals). Return unbind callback\nBind.unbindAll(obj:IBindable) | Unbind all properties and methods of `obj` (NB: still can bind new listeners after that!)\n\n## Extended API:\n\nMethod       | Description\n------------ | -------------\nBindExt.chain(chainExpr, listener) | Subscribe to sequence of invokations like `a.b.c(1).d..`, fires signal if any member of `chainExpr` was changed (automatically unsubscribes from old value and subscribes to new one). Methods can be specified with arguments. (NB: for the first time `listener` will be called automatically). `listener` behaves identicaly to `listener` in Bind.bind(). `BindExt.chain()`  `chainExpr`.\nBindExt.chainTo(chainExpr, toExpr) | Bind `chainExpr` to `toExpr`. (NB: for the first time binding is executed automatically). Returns a callback to unbind `chainExpr`.\nBindExt.expr(expr, listener) | Universal method. `expr` can be any valid Haxe expression. All `IBindable` instances and bindables properties will be found automatically. `listener` always accepts 2 arguments. Previous values automatically stored for methods. (NB: for the first time `listener` is called automatically). BindExt.expr() returns a callback to unbind `expr`.\nBindExt.exprTo(expr, toExpr) | Bind any valid `expr` to `toExpr`. (NB: for the first time `listener` is called automatically). Returns a callback to unbind `expr`.\n\n======\n\n## `bindx.IBindable` and @:bindable meta:\n\nBindx will process special meta - `@:bindable`. If `@:bindable` is set for the whole class then it will be inherited by all public properties which don't have this meta already. `@:bindable` only processed for classes and interfaces which implement `bindx.IBindable`.\n\nAccepts additional arguments: `@:bindable(paramName1 = value, paramName2 = value ...)`, short notation `paramName` equals with `paramName = true`\n\nParameter    | Default value | Description\n------------ | ------------- | -------------\ninlineSetter | false | Whether to add `inline` accessor to automatically generated setters or not.\nforce | false | Special mode to ignore other arguments. Creates signal for notifications, but does not create or modify setters, so developer can manage signal firing manually using `Bind.notify`. Also `force` mode extends list of allowed properties if setter is `null`, `never` or `dynamic` (without `force` mode binding such properties is impossible because setters cannot be generated or modified automatically).\nlazySignal | true | Whether to create notification signal immediately or wait till the first request. (By default: wait for request).\ninlineSignalGetter | false | if `lazySignal` is `true`, add `inline` accessor to automatically generated getter.\n\n\n======\n\n## Logging:\n\n```-D bindx_log=LOG_LEVEL```\n\nLog level    | Description\n------------ | -------------\n0 | Do not log anything\n1 | Concise log (optimal). (NB: also enabled with shorten flag: -D bindx_log)\n2 | Full binding log (useful for debugging)\n\n======\n\n## Installation:\n\n`haxelib install bindx2`\n\n======\n\n## Setup:\n\nDefine    | Description | Default value\n------------ | ------------- | -------------\n`bindx_lazy_signal` | lazy signal initiazation. `-D bindx_lazy_signal=0` disable option | true\n`bindx_inline_signal_getter` | inline signal getter | false\n`bindx_inline_setter` | inline autogenerated setter | false\n\n======\n\n## Additional\n\n- BindExt and `this`. Use `this.bindableA.bindableB` to listen changes of `bindableA`, not only `bindableB`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprofelis%2Fbindx2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprofelis%2Fbindx2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprofelis%2Fbindx2/lists"}