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
$(document).ready -> | |
photoHTML = (photo) => | |
"<li><a id='photo_#{photo.id}' href='#{photo.url}'><img src='#{photo.url}' alt='#{photo.alt}' /></a></li>" | |
$.ajax | |
url: '/photos' | |
type: 'GET' | |
contentType: 'application/json' | |
onSuccess: (response) => | |
for photo in response.photos |
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
class Photos.Photo | |
constructor: (@id, @url, @alt) -> | |
grayscaledURL: => | |
@url + ".grayscaled.jpg" | |
@fromJSON: (json) -> | |
new Photos.Photo(json.id, json.url, json.alt) |
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
class Photos.Backend | |
fetchPhotos: => | |
request = $.ajax( | |
url: '/photos' | |
type: 'GET' | |
contentType: 'application/json' | |
) | |
.then (response) => | |
photos = [] | |
for photo in response.photos |
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
class Photos.Gui | |
constructor: (@dom) -> | |
photoRow: (photo) => | |
$("<li><a id='photo_#{photo.id}' href='#{photo.url}'><img src='#{photo.url}' alt='#{photo.alt}' /></a></li>") | |
addPhoto: (photo) => | |
photoNode = @photoRow(photo).appendTo(@dom) | |
@linkClickHandlerToPhoto(photoNode, photo) |
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
class Photos.App | |
constructor: -> | |
@gui = new Photos.Gui($("#photos-list")) | |
@backend = new Photos.Backend() | |
start: => | |
@backend.fetchPhotos() | |
.done( | |
(photos) => | |
for photo in photos |
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
$(document).ready => | |
# put logic about starting your app here. | |
app = new Photos.App() | |
app.start() |
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
1 runs average: | |
{ | |
"Vue": 537.9427049774677, | |
"Backbone": 568.1099000212271, | |
"Knockout": 466.13354500732385, | |
"Ember": 1112.9281549947336, | |
"Angular": 788.7256610556506, | |
"React": 787.7407459600363, | |
"Om": 552.746056986507, | |
"Om v": 537.1314780204557, |
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
1 runs average: | |
{ | |
"Vue": 760.9619999420829, | |
"Backbone": 690.1490000891499, | |
"Knockout": 558.2629999844357, | |
"Ember": 1981.3939999730792, | |
"Angular": 816.4939999987837, | |
"React": 1021.7939999711234, | |
"Om": 812.5769999751355, | |
"Om v": 880.1849999581464, |
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
ui: (isLoaded) -> | |
{ | |
true: @mappingsList | |
false: @spinner | |
}[isLoaded]() |
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
for searchCriteriaIndex in Config.SearchCriteria | |
((_searchCriteriaIndex) -> that._roomOptionTestCase(_url, _searchCriteriaIndex))(searchCriteriaIndex) |
OlderNewer