Comments (2)
It sounds like you could use contextual components and closure actions. Is there any reason why you couldn't? I'm interested as I suspect that this addon might not have any use cases that aren't covered by core Ember primitives
from ember-component-inbound-actions.
Maybe my use case will make it clearer. I want to delay the destroy of a component, for animation purposes. Ideally Ember would have a sort of an async willDestroyElement
, similar to how the model
hook in a route is blocking. Reality is different :-).
So I'm using ember-component-inbound-actions
to send an action willClose
to the child component, which returns a Promise. The parent component then waits until this Promise resolves to effectively destroy the child component.
Something like this:
component:parent-component
// components/parent-component/template.hbs
{{#if showChildComponent}}
{{child-component actionReceiver=childComponent}}
{{/if}}
// components/parent-component/component.js
...
hideChildComponent() {
const childComponent = this.get('childComponent').target;
childComponent.actions.willClose.call(childComponent).then(() => {
this.set('showChildComponent', false);
});
}
...
component:child-component
// components/child-component/component.js
...
actions: {
willClose() {
return this.someAsyncStuffThatReturnsAPromise();
}
}
...
It's hacky I agree but it's the easiest solution I could come up with.
So now the addon allows us to perform a send
on an action receiver. However, it doesn't give us the return value of the action. I hope this makes it a bit clearer?
from ember-component-inbound-actions.
Related Issues (15)
- Using in an each block HOT 1
- Release new version HOT 2
- Using actionReceiver attribute for component causes the component to immediately rerender after being rendered HOT 6
- release #20 HOT 3
- confusing version check HOT 1
- Usage with contextual components HOT 1
- DEPRECATION on 2.18
- New release HOT 6
- "Asynchronous side-effects" from component unit tests HOT 1
- Binding the actionReceiver of a component breaks concatenatedProperties
- nameForm undefined HOT 3
- this can not be used in controller init
- Ember 1.13 compatability HOT 4
- License question 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 ember-component-inbound-actions.