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(['lazoCtl', 'underscore'], function (LazoCtl, _) { | |
return LazoCtl.extend({ | |
view: 'index', | |
components: [], | |
index: function (options) { | |
if (this.components.length) { |
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
{ [Error: Tried loading "continuation-local-storage" at /Users/jstrimp/github.com/jstrimpel/lazojs/continuation-local-storage.js then tried node's require("continuation-local-storage") and it failed with error: Error: Cannot find module 'continuation-local-storage'] | |
originalError: { [Error: Cannot find module 'continuation-local-storage'] code: 'MODULE_NOT_FOUND' }, | |
moduleName: 'continuation-local-storage', | |
requireModules: [ 'continuation-local-storage' ], | |
requireMap: | |
{ prefix: undefined, | |
name: 'continuation-local-storage', | |
parentMap: | |
{ prefix: undefined, | |
name: 'loggerUtils', |
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
// application base controller that resides at app/ctl.js | |
define(['lazoCtl'], function (LazoCtl) { | |
'use strict'; | |
return LazoCtl.extend({ | |
models: ['defaultModel1', 'defaultModel2'], | |
loadModels: function (callback) { |
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
// application base controller that resides at app/ctl.js | |
define(['lazoCtl'], function (LazoCtl) { | |
'use strict'; | |
return LazoCtl.extend({ | |
index: function (options) { | |
var self = this; |
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(['lazoCtl'], function (LazoCtl) { | |
'use strict'; | |
return LazoCtl.extend({ | |
index: function (options) { | |
this.addChild('some-target', 'some-component', { | |
// pass all references or cherry pick the ones you want | |
ctx: { |
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
// https://www.npmjs.org/search?q=request | |
define(['request'], function (request) { | |
'use strict'; | |
return { | |
image: function (req, options) { | |
// use request module here and forward the response to | |
// the appropriate options callback |
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) { |
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
// base controller | |
define(['lazoCtl'], function (Ctl) { | |
'use strict'; | |
return Ctl.extend({ | |
index: function (options) { | |
this.loadModel('session', { | |
success: function (model) { |