aurelia-binding-functions
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -7,5 +7,5 @@ declare module 'aurelia-binding-functions' { | ||
export interface BindingFunction { | ||
evaluate(callScope: CallScope, scope: Scope, lookupFunctions: any, mustEvaluate: boolean): any; | ||
connect?(callScope: CallScope, binding: Binding, scope: Scope): void; | ||
assign?(callScope: CallScope, scope: Scope, value: any, lookupFunctions: any): void; | ||
evaluate(callScope: CallScope, scope: Scope, lookupFunctions: any, mustEvaluate: boolean): any; | ||
bind?(callScope: CallScope, binding: Binding, scope: Scope, lookupFunctions: any): void; | ||
@@ -12,0 +12,0 @@ unbind?(callScope: CallScope, binding: Binding, scope: Scope): void; |
@@ -9,3 +9,3 @@ define(["require", "exports", 'aurelia-binding', 'aurelia-metadata'], function (require, exports, aurelia_binding_1, aurelia_metadata_1) { | ||
if (name.endsWith('BindingFunction')) { | ||
return new BindingFunctionResource(aurelia_binding_1.camelCase(name.substring(0, name.length - 15))); | ||
return new BindingFunctionResource('@' + aurelia_binding_1.camelCase(name.substring(0, name.length - 15))); | ||
} | ||
@@ -34,2 +34,2 @@ }; | ||
//# sourceMappingURL=binding-function-resource.js.map | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmluZGluZy1mdW5jdGlvbi1yZXNvdXJjZS5qcyIsInNvdXJjZVJvb3QiOiIvc291cmNlLyIsInNvdXJjZXMiOlsiYmluZGluZy1mdW5jdGlvbi1yZXNvdXJjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztJQUlBO1FBRUUsaUNBQW1CLElBQVk7WUFBWixTQUFJLEdBQUosSUFBSSxDQUFRO1FBQUcsQ0FBQztRQUU1QixrQ0FBVSxHQUFqQixVQUFrQixJQUFJO1lBQ3BCLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsaUJBQWlCLENBQUMsQ0FBQyxDQUFDLENBQUM7Z0JBQ3JDLE1BQU0sQ0FB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LEVBQUUsTUFBTSxJQUFHLENBQUM7UUFDNUIsOEJBQUM7SUFBRCxDQUFDLEFBbkJELElBbUJDO0lBbkJZLCtCQUF1QiwwQkFtQm5DLENBQUE7SUFFRCx5QkFBZ0MsWUFBWTtRQUMxQyxFQUFFLENBQUEsQ0FBQyxZQUFZLEtBQUssU0FBUyxJQUFJLE9BQU8sWUFBWSxLQUFLLFFBQVEsQ0FBQyxDQUFBLENBQUM7WUFDakUsTUFBTSxDQUFDLFVBQVMsTUFBTTtnQkFDcEIsMkJBQVEsQ0FBQyxNQUFNLENBQUMsMkJBQVEsQ0FBQyxRQUFRLEVBQUUsSUFBSSx1QkFBdUIsQ0FBQyxZQUFZLENBQUMsRUFBRSxNQUFNLENBQUMsQ0FBQztZQUN4RixDQUFDLENBQUE7UUFDSCxDQUFDO1FBRUQsMkJBQVEsQ0FBQyxNQUFNLENBQUMsMkJBQVEsQ0FBQyxRQUFRLEVBQUUsSUFBSSx1QkFBdUIsRUFBRSxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBQ2xGLENBQUM7SUFSZSx1QkFBZSxrQkFROUIsQ0FBQSIsInNvdXJjZXNDb250ZW50IjpbXX0= |
@@ -6,7 +6,7 @@ import { FrameworkConfiguration } from 'aurelia-framework'; | ||
export interface BindingFunction { | ||
evaluate(callScope: CallScope, scope: Scope, lookupFunctions: any, mustEvaluate: boolean): any; | ||
connect?(callScope: CallScope, binding: Binding, scope: Scope): void; | ||
assign?(callScope: CallScope, scope: Scope, value: any, lookupFunctions: any): void; | ||
evaluate(callScope: CallScope, scope: Scope, lookupFunctions: any, mustEvaluate: boolean): any; | ||
bind?(callScope: CallScope, binding: Binding, scope: Scope, lookupFunctions: any): void; | ||
unbind?(callScope: CallScope, binding: Binding, scope: Scope): void; | ||
} |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", './module-analyzer', './call-scope', './view-resources', './binding-function-resource'], function (require, exports, module_analyzer_1, call_scope_1, view_resources_1, binding_function_resource_1) { | ||
define(["require", "exports", './module-analyzer', './call-scope', './view-resources', './lexer', './binding-function-resource'], function (require, exports, module_analyzer_1, call_scope_1, view_resources_1, lexer_1, binding_function_resource_1) { | ||
"use strict"; | ||
@@ -10,2 +10,3 @@ exports.bindingFunction = binding_function_resource_1.bindingFunction; | ||
call_scope_1.patchCallScope(); | ||
lexer_1.patchLexer(); | ||
} | ||
@@ -15,2 +16,2 @@ exports.configure = configure; | ||
//# sourceMappingURL=index.js.map | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiL3NvdXJjZS8iLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0lBS1Esc0VBQWU7SUFBRSxzRkFBMkQ7SUFFcEYsbUJBQTBCLGVBQXVDO1FBQy9ELElBQU0sYUFBYSxHQUFHLGVBQWUsQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFBO1FBR3ZELG1DQUFrQixDQUFDLGFBQWEsQ0FBQyxDQUFBO1FBR2pDLHFDQUFtQixFQUFFLENBQUE7UUFHckIsMkJBQWMsRUFBRSxDQUFBO0lBQ2xCLENBQUM7SUFYZSxpQkFBUyxZQVd4QixDQUFBIiwic291cmNlc0NvbnRlbnQiOltdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiL3NvdXJjZS8iLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0lBTVEsc0VBQWU7SUFBRSxzRkFBMkQ7SUFFcEYsbUJBQTBCLGVBQXVDO1FBQy9ELElBQU0sYUFBYSxHQUFHLGVBQWUsQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFBO1FBR3ZELG1DQUFrQixDQUFDLGFBQWEsQ0FBQyxDQUFBO1FBR2pDLHFDQUFtQixFQUFFLENBQUE7UUFHckIsMkJBQWMsRUFBRSxDQUFBO1FBR2hCLGtCQUFVLEVBQUUsQ0FBQTtJQUNkLENBQUM7SUFkZSxpQkFBUyxZQWN4QixDQUFBIiwic291cmNlc0NvbnRlbnQiOltdfQ== |
define(["require", "exports", 'aurelia-templating', 'aurelia-metadata', 'aurelia-loader', 'aurelia-binding', 'aurelia-binding', './binding-function-resource'], function (require, exports, aurelia_templating_1, aurelia_metadata_1, aurelia_loader_1, aurelia_binding_1, aurelia_binding_2, binding_function_resource_1) { | ||
"use strict"; | ||
function patchModuleAnalyzer() { | ||
var analyzeOriginal = aurelia_templating_1.ModuleAnalyzer.prototype.analyze; | ||
aurelia_templating_1.ModuleAnalyzer.prototype.analyze = function analyze(moduleId, moduleInstance, mainResourceKey) { | ||
@@ -95,2 +94,2 @@ var mainResource; | ||
//# sourceMappingURL=module-analyzer.js.map | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLWFuYWx5emVyLmpzIiwic291cmNlUm9vdCI6Ii9zb3VyY2UvIiwic291cmNlcyI6WyJtb2R1bGUtYW5hbHl6ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7SUFRQTtRQUNFLElBQU0sZUFBZSxHQUFHLG1DQUFjLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQTtRQVF4RCxtQ0FBYyxDQUFDLFNBQVMsQ0FBQyxPQUFPLEdBQUcsaUJBQWlCLFFBQWdCLEVBQUUsY0FBbUIsRUFBRSxlQUF3QjtZQUdqSCxJQUFJLFlBQVksQ0FBQztZQUNqQixJQUFJLGFBQWEsQ0FBQztZQUNsQixJQUFJLFdBQVcsQ0FBQztZQUNoQixJQUFJLGdCQUFnQixDQUFDO1lBQ3JCLElBQUksR0FBRyxDQUFDO1lBQ1IsSUFBSSxhQUFhLENBQUM7WUFDbEIsSUFBSSxTQUFTLEdBQUcsRUFBRSxDQUFDO1lBQ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EsQ0FBQyxDQUFDO1lBQ3JFLENBQUM7WUFFRCxjQUFjLENBQUMsY0FBYyxHQUFHLGNBQWMsQ0FBQztZQUMvQyxjQUFjLENBQUMsWUFBWSxHQUFHLFlBQVksQ0FBQztZQUMzQyxjQUFjLENBQUMsU0FBUyxHQUFHLFNBQVMsQ0FBQztZQUNyQyxjQUFjLENBQUMsWUFBWSxHQUFHLEVBQUUsQ0FBQztZQUVqQyxNQUFNLENBQUMsY0FBYyxDQUFDO1FBQ3hCLENBQUMsQ0FBQTtJQUNILENBQUM7SUFyR2UsMkJBQW1CLHNCQXFHbEMsQ0FBQSIsInNvdXJjZXNDb250ZW50IjpbXX0= |
{ | ||
"name": "aurelia-binding-functions", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "An Aurelia plugin that makes it possible create BindingFunctions.", | ||
@@ -28,2 +28,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"aurelia-framework": "^1.0.0-beta.1.2.0", | ||
"browser-sync": "^2.11.0", | ||
@@ -30,0 +31,0 @@ "conventional-changelog": "0.5.3", |
# aurelia-binding-functions | ||
An Aurelia plugin that allows you to create bi-directional BindingFunctions in a similar way to BidingBehaviors. | ||
An Aurelia plugin that allows you to create bi-directional BindingFunctions in a similar way to [ValueConverters](http://aurelia.io/docs.html#/aurelia/binding/latest/doc/article/binding-value-converters) or BindingBehaviors. | ||
## How to install this plugin? | ||
1. In your project install the plugin and `rxjs` via `jspm` with following command | ||
1. In your project install the plugin via `jspm` with following command | ||
@@ -29,4 +29,72 @@ ```shell | ||
*TODO* | ||
You may create a BindingFunction the same way as you would BindingBehaviors or ValueConverters. | ||
The simplest implementation for a one-way binding might look as follows: | ||
```ts | ||
// async-binding-function.ts // | ||
export class AsyncBindingFunction implements BindingFunction { | ||
connect(callScope: CallScope, binding: Binding, scope: Scope) { | ||
// get the value of the first argument passed to our CallScope, | ||
// e.g. the property from async(property) | ||
const promise = callScope.args[0].evaluate(scope, binding.lookupFunctions, true) as Promise<any> & {promiseResult:any} | ||
// make sure the binding is updated | ||
// once the property "promiseResult" changes on the "promise" | ||
binding.observeProperty(promise, 'promiseResult') | ||
// set the "promiseResult" property once the Promise resolves | ||
if (promise.promiseResult === undefined && typeof promise.then === 'function') { | ||
promise.then(value => { | ||
promise.promiseResult = value | ||
}) | ||
} | ||
} | ||
evaluate(callScope: CallScope, scope: Scope, lookupFunctions, mustEvaluate: boolean) { | ||
const promise = callScope.args[0].evaluate(scope, lookupFunctions, true) as Promise<any> & {promiseResult:any} | ||
// return the value of "promiseResult" property | ||
// or undefined if the value of the argument is not set | ||
return promise ? promise.promiseResult : undefined | ||
} | ||
} | ||
``` | ||
Now the BindingFunction can be used inside bindings prefixed by `@`, i.e. `@async()`: | ||
```html | ||
<require from="./async-binding-function"></require> | ||
<h2>${ @async(somePromise) }</h2> | ||
``` | ||
A BindingFunction can implement the following methods: | ||
```ts | ||
export interface BindingFunction { | ||
// invoked by Aurelia to either: | ||
// - retrieve the current value of the binding | ||
// - trigger a call (e.g. by click.delegate) | ||
evaluate(callScope: CallScope, scope: Scope, lookupFunctions, mustEvaluate: boolean): any | ||
// invoked if the binding is used as a source of values | ||
// (as opposed to being used to trigger changes, like in click.delegate) | ||
// this is invoked by Aurelia after bind() and every time the binding is recomputed | ||
connect?(callScope: CallScope, binding: Binding, scope: Scope): void | ||
// when the binding is two-way, invoked every time new values are fed into the binding by Aurelia | ||
assign?(callScope: CallScope, scope: Scope, value: any, lookupFunctions: any): void | ||
// invoked when the binding is bound | ||
bind?(callScope: CallScope, binding: Binding, scope: Scope, lookupFunctions: any): void | ||
// invoked when the binding is unbound | ||
unbind?(callScope: CallScope, binding: Binding, scope: Scope): void | ||
} | ||
``` | ||
For a **one-time binding** you only need to implement the `evaluate()` method. | ||
A **one-way binding** will require you to also implement `connect()`, while a **two-way binding** requires you to also implement `assign()`. | ||
## Dependencies | ||
@@ -33,0 +101,0 @@ |
@@ -11,3 +11,3 @@ import {camelCase} from 'aurelia-binding' | ||
if (name.endsWith('BindingFunction')) { | ||
return new BindingFunctionResource(camelCase(name.substring(0, name.length - 15))); | ||
return new BindingFunctionResource('@' + camelCase(name.substring(0, name.length - 15))); | ||
} | ||
@@ -35,2 +35,2 @@ } | ||
metadata.define(metadata.resource, new BindingFunctionResource(), nameOrTarget); | ||
} | ||
} |
@@ -6,2 +6,3 @@ import {FrameworkConfiguration} from 'aurelia-framework' | ||
import {patchViewResources} from './view-resources' | ||
import {patchLexer} from './lexer' | ||
export {bindingFunction, BindingFunctionResource} from './binding-function-resource' | ||
@@ -20,10 +21,36 @@ | ||
patchCallScope() | ||
// monkey patch Lexer to allow '@' as a start for an identificator | ||
patchLexer() | ||
} | ||
export interface BindingFunction { | ||
/** | ||
* invoked by Aurelia to either: | ||
* - retrieve the current value of the binding | ||
* - trigger a call (e.g. by click.delegate) | ||
*/ | ||
evaluate(callScope: CallScope, scope: Scope, lookupFunctions, mustEvaluate: boolean): any | ||
/** | ||
* invoked if the binding is used as a source of values | ||
* (as opposed to being used to trigger changes, like in click.delegate) | ||
* this is invoked by Aurelia after bind() | ||
*/ | ||
connect?(callScope: CallScope, binding: Binding, scope: Scope): void | ||
/** | ||
* when the binding is two-way, invoked every time new values are fed into the binding by Aurelia | ||
*/ | ||
assign?(callScope: CallScope, scope: Scope, value: any, lookupFunctions: any): void | ||
evaluate(callScope: CallScope, scope: Scope, lookupFunctions, mustEvaluate: boolean): any | ||
/** | ||
* invoked when the binding is bound | ||
*/ | ||
bind?(callScope: CallScope, binding: Binding, scope: Scope, lookupFunctions: any): void | ||
/** | ||
* invoked when the binding is unbound | ||
*/ | ||
unbind?(callScope: CallScope, binding: Binding, scope: Scope): void | ||
} |
@@ -8,5 +8,7 @@ import {ModuleAnalyzer, ResourceModule, ResourceDescription, HtmlBehaviorResource, viewStrategy, TemplateRegistryViewStrategy, ViewResources, ResourceLoadContext, _hyphenate} from 'aurelia-templating' | ||
// 3. patch ModuleAnalyzer to understand BindingFunctions | ||
/** | ||
* patch ModuleAnalyzer to understand BindingFunctions | ||
* ModuleAnalyzer from https://github.com/aurelia/templating/blob/master/src/module-analyzer.js | ||
*/ | ||
export function patchModuleAnalyzer() { | ||
const analyzeOriginal = ModuleAnalyzer.prototype.analyze | ||
/** | ||
@@ -20,4 +22,2 @@ * Analyzes a module. | ||
ModuleAnalyzer.prototype.analyze = function analyze(moduleId: string, moduleInstance: any, mainResourceKey?: string): ResourceModule { | ||
// const originalReturnValue = analyzeOriginal.apply(this, arguments) | ||
let mainResource; | ||
@@ -115,3 +115,2 @@ let fallbackValue; | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64488
34
1031
163
29