This file contains 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
componentWillReceiveProps(nextProps) { | |
if (nextProps.lastRequestedUserLocationAt > this.props.lastRequestedUserLocationAt) { | |
this.centerMapToUser(nextProps.currentLocation); | |
} | |
if (nextProps.lastUpdated > this.props.lastUpdated) { | |
const markers = this.createMarkersForLocations(nextProps); | |
if (markers && Object.keys(markers)) { | |
const clusters = {}; |
This file contains 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
// base controller | |
define(['lazoCtl'], function (Ctl) { | |
'use strict'; | |
return Ctl.extend({ | |
index: function (options) { | |
this.loadModel('session', { | |
success: function (model) { |
This file contains 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
define(['lazoApp'], function (App) { | |
'use strict; | |
return App.extend({ | |
initialize: function (callback) { | |
var html = '<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]--><html lang="en">'; | |
LAZO.app.setHtmlTag(html); | |
LAZO.app.setBodyClass('some-class another-class'); |
This file contains 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
// backs user model | |
define(['lazoSyncher'], function (LazoSyncher) { | |
return LazoSyncher.extend({ | |
authenticate: function (credentials, options) { | |
// authenticate user using credentials | |
// you can call options.success or options.error | |
// update the user model, auth token, etc. | |
} |
This file contains 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
// in a controller | |
// you can either update the collection directly or send | |
// a message in the LAZO.app dispatcher | |
// (you can use a controller dispatcher if you want to be more granular) | |
var socket = io(); | |
var self = this; | |
var notifications = this.ctx.collections.notifications; | |
// three different approaches to re-rendering a badge count | |
socket.on('notification', function (msg) { |