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
// ---------------------------------------- | |
// /path/to/dependency.js | |
define(function() { | |
return { | |
doSomethingWithIt: function() { | |
// blah | |
} | |
}; | |
}); |
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
// locator_news_responsive/webapp/static/js/module/main.js | |
define([ | |
'vendor/ender/reqwest', | |
'locator/bootstrap', <---- 'locator' here...where does this path come from? | |
'locator/locatorView' <---- is this the curl path that _we_ define in _our_ base.spv? | |
], function( | |
reqwest, | |
bootstrap, | |
LocatorView | |
){ |
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
====== | |
BEFORE | |
====== | |
// base.spv | |
86: 'locator': '../../../locator/news/responsive/<?= $config['locatorVersion'] ?>/js/' | |
// localweather.js | |
3: 'locator/module/main', |
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
// LOCATOR | |
locator:error [response, actionType] | |
locator:renderChangePrompt | |
locator:renderForm | |
locator:open [selectorString] | |
locator:close | |
locator:locationChanged [location] <---- maybe we should listen to this? | |
locator:renderWait | |
locator:searchResults [data] | |
locator:newsLocalRegions [data] |
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
====== | |
BEFORE | |
====== | |
This is how we currently do 'JS templating' when we want to insert | |
snippets of markup into the DOM: Strings of markup in an array, | |
using [].join(''); We then do String.replace() to replace the | |
{{placeholders}} with content. | |
// minihyper.js | |
define([ |
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
// -- changed lines | |
define(['module/bootstrap', 'module/hyperpuff/minihyper'], function(news, MiniHyper) { | |
module('MiniHyper'); | |
test('has an init method', function() { | |
ok('init' in MiniHyper); | |
}); |
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
// -- changed lines | |
return { | |
init: function() { | |
// store DOM references | |
var hyperpuff = news.$('.hyperpuff'), | |
hyperTitleText = news.$('.hyper-title', hyperpuff).text(), | |
firstGroupArticles = news.$('.group:first-child .article-wrapper article', hyperpuff), | |
insertBeforeTarget = news.$('.story-body .introduction'), |
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
/*global define:true */ | |
define( | |
[ | |
'module/bootstrap', | |
'module/timestamp', | |
'module/imageenhancer', | |
'module/transclude', | |
'module/hyperpuff/hyperpuff' | |
], function( |
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
// device.config.js | |
define(['module/config/config'], function( config ) { | |
// some logic up somewhere | |
var device; | |
switch(true) { | |
case (screen.width > 1200): device = 'wide'; break; | |
case (screen.width > 640): device = 'tablet'; break; | |
... | |
} |
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
define(function() { | |
// Config object | |
var Config = function( initialSettings ) { | |
var store = (initialSettings && typeof initialSettings === 'object') ? initialSettings : {}; | |
return { | |
get: function( key ) { | |
if(key) return store[key]; | |
return store; |