Angularjs show chat notification in all pages - angularjs

I have created a simple chat application in Angularjs using pubnub.
I would like to notify the user if a new message is received, right now I can notify the incoming messages only if the user is in the chat view.
I need to show the notification even if the chat is not in view.
I can use $rootScope.$on in all my controllers to listen the callbacks and then show the notification.
But I would like to know if there is any other efficient way.
I am using angular-toastr to show the notifications.

Related

Calendly iframe, no event listener for updateEvent

So I'm working with Calendly iframe and I'm having an unexpected problem, I searched the docs so much and couldn't find a solution.
So Calendly offers a decent iframe with some event listeners for specific use-cases.
I have a single use scheduling url that the iframe receives, when the event is scheduled I fetch a reschedule-url and provide the iframe with it.
The problem is, the event listener for schedule an event is not the same as for update event, and a listener isn't provided for such event... which is so weird for me.
I have no indication when a user updates an event, I can't refresh information from my back-end and display the user with new data.
I guess I'm not the first one with that kind of problem.
Any suggestions?

Detect window close on React

I am developing a SCORM course using React and I must detect when user closes the tab to send the correct event to Lms
I tried to search for similar questions, and even following the answers of this thread reactjs event listener beforeunload added but not removed I could not make it work, onbeforeunload is just not called.
Also componentwillunmount do not works when user closes the window directly.
Any suggestions about how I could achieve this?

In Messenger bot webview , How to know that user has completed registration form

In messenger bot i was showing a webview form here how can we know that user completed form and trigger a message a particular user about successfully form submitted
When the submit button for the form is clicked you can call requestCloseBrowser() to close the webview, and send an event to your webhook to notify it to send the follow up message in the conversation.
https://developers.facebook.com/docs/messenger-platform/webview#close

Re-disable background for uibModal popup in AngularJS

https://angular-ui.github.io/bootstrap/
AngularJS uibModal popup question.
I have a form where I am entering certain input fields and selecting multiple dropdown. On selection of dropdown a web API call triggers, then on submitting the form I opening uibModal popup. Till now web Api call is in pending state, popup is open and background is disabled. If user does not not perform any action on uibmodal then after 30-40 seconds response comes from web API which was triggered on dropdown selection, now the background is enabled and popup remains open.
I have two different controllers, one where popup and web API call is triggered and one for uibModal popup.
I want to re disable the background when the web API response comes.
Thanks in Advance!

How to use a Backbone view in bootstrap modal for login and perform task after login?

I have a backbone view call LogOnView. In my LogOnView A user can login using username and password. There exist all type of server and client side validation. I want to use this view in a bootstrap modal when a user click a button in another view. I can add all the content LogOnView into bootstrap modal-body like this
$('.modal-body').html(new LogOnView().el);
N.B. I am enabling the Bootstrap modal dynamically that means from a view (using javascript).
$('#LogOnPopUp').modal('toggle');
By this content of LogOnView is successfully added to Boostrap modal. And also login and validation is ok as it ok in LogOnView. But I need to find a way to do another work when user Login successfully. That means when an user successfully login the modal popup will close and another task will need to done in this view.
So what can I do in this aspect? Any advice will be appreciable.
N.B: (summary/similar criteria )
It's all the same as facebook like. When anyone like a content of other website using facebook account. A user click in like button then a modal popup is opened and after logged in there his like is confirmed.
I want to do something like this using my LogOnView into bootstrap modal.
I'm not sure I understand your question. But if you want to execute an action once some work has been done (i.e. logging on, in your case), you can handle "doing things after" using jQuery Deferreds and promises: http://api.jquery.com/category/deferred-object/
I've written 2 posts on the subject, if this is the route you want to use:
http://davidsulc.com/blog/2013/04/01/using-jquery-promises-to-render-backbone-views-after-fetching-data/
http://davidsulc.com/blog/2013/04/02/rendering-a-view-after-multiple-async-functions-return-using-promises/

Resources