Fire action in Backbone View after two events have been triggered - backbone-events

I understand how to bind an action in a Backbone View to an event trigger but, how can you fire an action watching the condition that two precise envets have been triggered?

For that you can use jquery functionality like:
$.when(func1, func2).then(func3);
It acts like deffered and promise here.

Related

Does AppSync Subscription Work When User is No Longer in View Controller or when App is Background

I am reading this sample app, and noticed that the call for subscriptions happens in viewDidLoad(). This raises the following question:
1) Is the user subscribed to event comments only when he/she is in that particular view controller? In other words, if the user navigates to another scene, is the subscription no longer in effect? How can I make it so that once a user subscribes to something, he/she is subscribed to it until told to stop?
I also have another question:
2) Can I changed the parameters passed to a subscription during the app? For instance, if I am subscribing to multiple events, then I would pass an array of event_id as parameter. For some condition, I will add an event to the array. So each time I add an event, do I have to restart the subscription?

Can't fire Lifecycle events on Subcomponent

I'm trying to fire the Lifecycle events from Navcontroller as described in the Api docs
The problem is, that I just can fire these events by a parent component, sub components does not fire . Is there something I have to add/change, when I want to add these events to Subcomponents ?
(I think there is no code needed to undestand the problem)
System:
Ubuntu 16.04 /
Node 6.7.x /
npm 3.10.x /
ionic 2 rc0
An inner component knows nothing about Ionic lifecycle events. Ionic/pages will not notify inner components about loading, become the active page, etc. If you need your inner component to do something based on lifecycle events, tie the parent lifecycle event with the inner component using Angular's #ViewChild decorator.
In parent component get a reference to the child component using #ViewChild as explained here. Then, inside the parent lifecycle event, call a public function defined in child component.
Hope it helps,
Xavi

How to trigger action on route from controller in ember

Considering this example: http://emberjs.jsbin.com/hecewi/1/edit?html,js,output
The docs state that an action will be searched for on the controller first (which works in the example e.g. by pasting the actions hash into the IndexController), then on the current route and then along its parent routes until it hits ApplicationRoute. I'd expect the testCamel action in the example to be triggered then, but instead there is an error about the route did not get handled. How to do it right?
The code to trigger an action is indeed correct. It's just an unfortunate chosen example. Since your route will initialize the controller, the route itself is probably not completely initialized by the time the action is sent. If you, for example, schedule the action to be triggered in the following run loop, it works perfect:
http://emberjs.jsbin.com/yaseva/1/edit

how to test with custom dom event in angularjs

I have written custom events for mobile devices in jasmine,
and I am trying to fire the events.
so instead of
angular.element()[0].click()
how may I trigger custom events and other events to trigger functions?
This should work:
angular.element().triggerHandler('my-custom-event-name');
If you want to attach additional data to your event:
angular.element().triggerHandler('my-custom-event-name', {'foo': 'bar'});
To add to the above post, you can pass a custom event (with extra data) by doing this:
angular.element().triggerHandler({
'type': 'my-custom-event-name',
'foo': 'bar'
});

How can I pass data bidirectionally between two classes in C++

I am working with the MVC architecture. I have my GUI all set up, and I have my controller using the model for data access. My question is: how do I set up bidirectional data flow between the controller and the GUI(view). I am using Qt, so When I hit a button, it will fire off an action. In order to make that Action fire off to the controller, I need an instance of it. Then from the controller side, I need an instance of the view so I can tell it how to behave. So, how can achieve this communication? Am I even on the right track? please let me know what you guys think.
Thanks
The view doesn't need to be explicitly aware of the controller. The controller can connect to any of the view's signals and the signals can relay relevant data or they can be empty. When the controller handles them in a slot, it can call methods on the view to fetch data if it isn't already included in the signal. The controller can also call any view method at any time.
I usually connect widget(button) signals directly to slots in the view class and expose custom aggregate signals that a controller can connect to instead of exposing all the widgets themselves.