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
savePowerUps: (playerGameId, powerUps, callback) => | |
console.debug "savePowerUps", playerGameId, powerUps | |
params = {player_game_id: playerGameId, powerups: powerUps} | |
$.post("#{@gameEngineUrl}/word_scramble/player/save_powerups", params, 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
class Backend | |
getData: -> | |
request = $.ajax | |
type: "GET" | |
dataType: "JSON" | |
url: '/foo' | |
request.pipe (response) -> | |
DomainObject.fromJSON(response) | |
# And then in initializer code: |
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
Photos = {} | |
class Photos.App | |
constructor: -> | |
@gui = new Photos.Gui($("#photos-list")) | |
@backend = new Photos.Backend() | |
start: => | |
@backend.fetchPhotos() | |
.done( |
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, |
OlderNewer