Created
September 1, 2015 18:00
-
-
Save gregturn/686d3c1e5e3f3bb317d5 to your computer and use it in GitHub Desktop.
Chunk I want to background
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
| componentDidMount: function () { | |
| this.loadItemsFromServer(); | |
| this.loadGalleriesFromServer(); | |
| // I want to background this --v | |
| stompClient.register([ | |
| {route: '/topic/backend.newItem', callback: this.addItemToUnlinkedList}, | |
| {route: '/topic/backend.deleteItem', callback: this.removeItemFromUnlinkedList}, | |
| {route: '/topic/backend.removeItemFromGallery-item', callback: this.addItemToUnlinkedList}, | |
| {route: '/topic/backend.removeItemFromGallery-gallery', callback: this.updateGallery}, | |
| {route: '/topic/backend.addItemToGallery-item', callback: this.removeItemFromUnlinkedList}, | |
| {route: '/topic/backend.addItemToGallery-gallery', callback: this.updateGallery} | |
| ]); | |
| // ------------------------------^ | |
| }, |
Author
Perfect! That should speed up rendering the UI and let websocket registration roll out when it rolls out.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd probably do it like this.
when.trydefers the execution ofstompClient.registerand returns promise that will fulfill afterstompClient.registerreturns.Just keep in mind that
when.trymoves the call tostompClient.registerinto the future, i.e.componentDidMountwill return beforestompClient.registeris called.