Skip to content

Instantly share code, notes, and snippets.

@niieani
Created June 8, 2016 18:36
Show Gist options
  • Save niieani/8dcc6ea03d21c76e46d3d21b8c0ea8dc to your computer and use it in GitHub Desktop.
Save niieani/8dcc6ea03d21c76e46d3d21b8c0ea8dc to your computer and use it in GitHub Desktop.
Binding Function interface idea
interface BindingFunction {
/**
* invoked by Aurelia when the binding is bound
* updateView is a method that can be used to update the binding
* parameters is an array of evaluated parameters passed to the binding at the time of binding
*/
subscribe(updateView: (newValue) => void, parameters: Array<any>)
/**
* invoked by Aurelia when the binding or its parameters changes value
* e.g. typing inside: <input value.bind="binding()">
*/
onValue(value: any, parameters: Array<any>)
/**
* invoked by Aurelia when the binding invoked
* e.g. clicking: <button click.trigger="binding()">
*/
onInvocation(event: Event, parameters: Array<any>)
/**
* invoked by Aurelia when the binding is unbound
* used for cleanup of things that were setup during subscribe
*/
unsubscribe()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment