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
var data = { | |
type: "something", | |
name: "whatever", | |
addresses: [ | |
{ | |
type: "read_address", | |
address: "1/2/3", | |
value: "10" | |
}, | |
{ |
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
// Collecting all unique affected app version for a given data set | |
var jsonStats = [ | |
{app_versions: ['1.2','1.2.3']}, | |
{app_versions: null}, | |
{app_versions: ['1.2','1.3']} | |
]; | |
var app_versions = _.uniq(_.flatten(_.compact(_.map(jsonStats, function(day){return day.app_versions })))); | |
// ["1.2", "1.2.3", "1.3"] | |
// Bye bye stupid for loops! |
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
paparanKu = Backbone.View.extend({ | |
events: { | |
"click #elemenKu": "caraKu" | |
}, | |
caraKu: function(){ | |
alert("Tidak Menyesal Belajar BackboneJS!"); | |
}, | |
render: 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
var modelKu = Backbone.Model.extend({}); | |
modelDia = new modelKu(); | |
modelDia.bind("change", function(model, collection){ | |
alert("ada perubahanlah: " + model.get('some_attribute')); | |
}); | |
modelDia.set({some_attribute: "nilai untuk sesuatu"}); |
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
<form action="/login" id="login-form"> | |
Nama pengguna: <input type="text" id="nPengguna"><br> | |
Kata Laluan: <input type="password" id="kLaluan"><br> | |
<button id="login">Masuk</button> | |
</form> |
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
el: $("#login-form") |
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
events: { | |
"click #login": "login" | |
} |
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
window.LoginView = new LoginView({model: new Pembenaran()}); |
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
RouterKu = Backbone.Router.extend({ | |
routes: { | |
"sini/sana" : "bertindak" | |
}, | |
bertindak: function(){ | |
// lakukan sesuatu disini | |
} | |
}); |
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
window.Zoo = Backbone.Collection.extend({ | |
model:Makhluk, | |
url:"./api/makhluk", | |
initialize: function() { | |
this.deferred = this.fetch(); | |
} | |
}); |
OlderNewer