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 [], () -> | |
class mLoader | |
modules: ["modules/footer", "modules/header"] | |
init: () -> | |
for m in @modules | |
moduleShortName = m.split("/")[1] + "Module" | |
modulePath = m + "/index" | |
define moduleShortName, [modulePath], (mod) -> |
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
sync: ( method, collection, options ) -> | |
content = localStorage.getItem( @url() ) if localStorage | |
if content and not navigator.onLine | |
options.success JSON.parse content | |
else | |
return Backbone.sync( method, collection, options ).done ( response ) => | |
localStorage.setItem( @url(), JSON.stringify( response ) ) if localStorage |
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 ["backbone", "marionette"], (Backbone, Marionette) -> | |
ControlItemView = Marionette.Layout.extend | |
template: '<div control="{{controlType}}" model="controlModel"/>' | |
initialize: (options) -> | |
onRender: -> | |
MyCompositeView = Marionette.CompositeView.extend |
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 ["marionette"], (Marionette) -> | |
BaseControlWrapper = Marionette.Layout.extend | |
initialize: (options) -> | |
@controlClassResolve(@model.get "controlType") | |
self = @ | |
@deferred.done( (controlTypeClass) -> | |
self.onDeferredDone(controlTypeClass) |
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
sumInForeSeconds = (a, b, callback) -> | |
console.log "sumInFiveSeconds" | |
setTimeout(()=> | |
callback(a + b) | |
, 4000) | |
sumInFiveSeconds = (a, b, callback) -> | |
console.log "sumInFiveSeconds" | |
setTimeout(()=> | |
callback(a + b) |
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
# blank method | |
callback = (resultClass) -> | |
# loading controllers directly instead of modules | |
require ["modules/" + name + "/" + name + "Controller", "modules/" + name + "/declaration"], (ControllerClass, declaration) => | |
types = findNested(declaration.componentItems, "itemType") | |
console.log types | |
promises = [] |
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
processRouteMap = (routes) -> | |
requirejs.config | |
nodeRequire: require | |
paths: | |
"routeMap" : __dirname + "/../../../app/js/" + "routeMap" | |
"requireConfig" : __dirname + "/../../../app/js/" + "requireConfig.js" | |
"text" : __dirname + "/../../../app/js/vendors/requirejs-text/text" | |
requirejs ["routeMap", "text!requireConfig"], (routeMap, requireConfig) -> | |
console.log "requireConfig", requireConfig |
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 -> | |
findNested = (obj, key, memo) -> | |
i = undefined | |
memo = [] if Object::toString.call(memo) isnt "[object Array]" | |
for i of obj | |
if Object::hasOwnProperty.call(obj, i) | |
if i is key | |
memo.push obj[i] | |
else findNested obj[i], key, memo if Object::toString.call(obj[i]) is "[object Object]" | |
memo |
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 [ | |
"underscore" | |
"when" | |
], (_, When) -> | |
return (options) -> | |
extend = (componentDefinition, wire) -> | |
When.promise (resolve) -> |
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 -> | |
class AutoCompleteController | |
# @injected | |
input: undefined | |
# @injected | |
listCollection: undefined | |
curId: 0 |
OlderNewer