Comments (11)
interesting. what sort of custom bindings have you made? would they be helpful to roll back into ampersand-dom-bindings instead?
from ampersand-view.
@cdaringe, they are a subset of the text/innerHtml binding types.
For example, instead of polluting my models with derived types to convert a prop to a specific date/monetary or other format, I use a binding types to achieve this globally.
I use custom bindings instead of custom dataTypes because I may use the original value in other derived properties, bindings, or computations.
I would like propose changes to ampersand-dom-bindings complimentary to this proposal.
from ampersand-view.
instead of polluting my models with derived types to convert a prop to a specific date/monetary or other format, ...
I like that. It's a great idea.
I think we should definitely support the extensibility you need. While im not gung-ho against your original proposal, perhaps we could simply add hooks to dom-bindings to make it more composable? that way, there's only change required in one spot. i think it's a little clearer to extend dom-bindings too. the flow remains unchanged in &-view, and there's no logic to debug outside of dom-bindings. i think it'd be easier to reason about. what are your thoughts?
from ampersand-view.
@cdaringe it depends on how the changes to ampersand-dom-bindings are made, it may still require other changes to &-view.
Either allowing the new bindings to be passed in from the view, or making dom-bindings a class that can be extended instead of a function would both require changes to the view.
from ampersand-view.
dom-bindings a class that can be extended instead of a function
just thinking out loud. i was thinking something similar to ^^. basically add .extend()
method to dom-bindings. on app init, you extend to add your custom bindings. maybe im missing something, but I don't think that'd required an &-view update
from ampersand-view.
@cdaringe that would be treating dom-bindings as a singleton like ampersand-app? What if you overwrite one of the original bindings but don't want to use it in every view or you just don't want them available in every view? I'm fine with doing it that way, just thought I would bring up the possible objections.
from ampersand-view.
yea, that'd be an issue. frankly, I personally wouldn't want to squash a dom-binding. i can see that really confusing the rest of the dev-team. i'd prefer instead to maybe namespace it? like myproduct/binding-name
. again, i'm super on board with the need to make it extensible, and think you've got a great use case. i'm iffy on the requirement to convert what is otherwise a general utility function provider into utility provider instances. from my current thinking, i wouldn't ever think of creating an isolated lodash instance to get special utility functions. i'd definitely extend it (as peeps commonly do), but instancifying dom-bindings seems like convolution from my perspective. again, just an opinion :)
from ampersand-view.
hi Richard. As a user of ampersand, I'm interested in your use case (perhaps i'll adopt that approach). you said:
"For example, instead of polluting my models with derived types to convert a prop to a specific date/monetary or other format, I use a binding types to achieve this globally."
can you give me an example where that is preferred?
from ampersand-view.
I opened AmpersandJS/ampersand-dom-bindings#53 so that we can discuss changes specific to ampersand-dom-bindings there.
from ampersand-view.
@cdaringe, I would like to look at adding the ability to pass in bindings defined in the view, similar to ampersand-state dataTypes.
E.G. defined an attribute on your view called bindingTypes as a key -> function store, then
call bindings with context, bindings, and bindingTypes.
from ampersand-view.
@RickButler, if you want to modify it to do so, i'll support it so long as:
- it comes with test(s)
- it comes w/ a README update
- isn't too invasive
throw up a PR, and we can get it going. thanks for explaining all your stuff so clearly :)
from ampersand-view.
Related Issues (20)
- List cdaringe as lead maintainer and add him to core team HOT 6
- deep nested subviews issue of re-rendering HOT 14
- Possible fix to template engines that attempt to copy the getter-laden context from going crazy HOT 3
- $('.className') vs this.queryByHook('hookName') HOT 2
- The ability to extend the declarative style of the subviews is very limited HOT 6
- Using deprecated version of ampersand-state HOT 1
- get-object-path issues + proposal HOT 6
- reset() throwing errors since I build from ES6 HOT 4
- Release ampersand-*-view HOT 1
- Release new version HOT 1
- Enhance docu about _upsertBindings() HOT 4
- _downsertBindings needs to clear the _subviews array
- renderSubview expects subview render method to return subview instance HOT 3
- Possible bug with the auto-generated prepareView() ? HOT 4
- Enchancement bubble subview events
- Enhancement to provide single declarative place for event listeners
- Looking to become maintainer HOT 6
- package-lock.json HOT 1
- NPM Audit HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ampersand-view.