Last active
August 29, 2015 14:05
-
-
Save waynerobinson/dd0809c1739f8ee44828 to your computer and use it in GitHub Desktop.
Check to see if Intercom messenger open.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Control how Intercom.io messenger is updated before it moves to realtime. | |
| intercomOpenCheck = $interval( () -> | |
| if $("#intercom-messenger.intercom-messenger-active").length > 0 | |
| $rootScope.intercomMessengerActive = true | |
| else | |
| $rootScope.intercomMessengerActive = false | |
| , 7000) | |
| intercomIntervalCounter = 0 | |
| intercomUpdateCheck = $interval( () -> | |
| # If messenger open, update every 3 seconds | |
| if $rootScope.intercomMessengerActive | |
| Intercom("update") | |
| intercomIntervalCounter = 0 | |
| # If messenger closed, update every 60 seconds | |
| else | |
| if intercomIntervalCounter > 20 | |
| Intercom("update") | |
| intercomIntervalCounter = 0 | |
| intercomIntervalCounter += 1 | |
| , 3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment