.done(data => { if (data && data.ok && data.result && data.result.state) { const state = formatState('down', JSONP.unpack(data.result.state), hash) resolve(state) } else { reject(new Error('Unable to load bookmark')) } })
connection.on('message', (args) => { args = jsonpack.unpack(args); server.act(args[0], args[1], function (err, result) { let res = { err: err, result: result, ident: args[1].ident, args: args, name: args[1].name }; connection.write(res); }); });
$.get(url, function(data) { $('p.hint').hide(); new Game(map.data.map, jsonpack.unpack(data), [user1.name, user2.name], 300, $('#playground')); $('#playground').show(); }).fail(function(res, _, err) {
const unpackResponse = response => jsonpack.unpack(window.atob(response));
$.post('/code/preview', { code: code, map: map, enemy: enemy }, function(data) { var interval = 300 / parseFloat($('.js-speed').val(), 10); game = new Game(data.map, jsonpack.unpack(data.result), data.names, interval, $('#playground')); $(_this).removeClass('is-disabled'); }).fail(function(res, _, err) {
$.get('/replay?user1=' + encodeURIComponent(user1) + '&user2=' + encodeURIComponent(user2) + '&map=' + map.id, function(data) { $('p.hint').hide(); new Game(map.data.map, jsonpack.unpack(data.replay), data.names, 300, $('#playground')); $('#playground').show(); }).fail(function(res, _, err) {