mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-03 16:50:15 +00:00
Backbone fixes
This commit is contained in:
2
Definitions/backbone-0.9.d.ts
vendored
2
Definitions/backbone-0.9.d.ts
vendored
@@ -142,6 +142,8 @@ declare module Backbone {
|
||||
navigate(fragment, options? );
|
||||
}
|
||||
|
||||
export var history: History;
|
||||
|
||||
export class History {
|
||||
start(options? );
|
||||
}
|
||||
|
||||
@@ -24,33 +24,33 @@ object.off();
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
var Sidebar = Backbone.Model.extend({
|
||||
promptColor: function() {
|
||||
var cssColor = prompt("Please enter a CSS color:");
|
||||
this.set({color: cssColor});
|
||||
}
|
||||
promptColor: function () {
|
||||
var cssColor = prompt("Please enter a CSS color:");
|
||||
this.set({ color: cssColor });
|
||||
}
|
||||
});
|
||||
|
||||
var sidebar = new Sidebar();
|
||||
sidebar.on('change:color', (model, color) => $('#sidebar').css({background: color}));
|
||||
sidebar.set({color: 'white'});
|
||||
sidebar.on('change:color', (model, color) => $('#sidebar').css({ background: color }));
|
||||
sidebar.set({ color: 'white' });
|
||||
sidebar.promptColor();
|
||||
|
||||
////////
|
||||
|
||||
var Note = Backbone.Model.extend({
|
||||
initialize: () => { },
|
||||
author: () => { },
|
||||
coordinates: () => { },
|
||||
allowedToEdit: (account) => {
|
||||
return true;
|
||||
}
|
||||
initialize: () => { },
|
||||
author: () => { },
|
||||
coordinates: () => { },
|
||||
allowedToEdit: (account) => {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var PrivateNote = Note.extend({
|
||||
|
||||
allowedToEdit: function(account) {
|
||||
return account.owns(this);
|
||||
}
|
||||
allowedToEdit: function (account) {
|
||||
return account.owns(this);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -58,14 +58,14 @@ var PrivateNote = Note.extend({
|
||||
//////////
|
||||
|
||||
var note = Backbone.Model.extend({
|
||||
set: function(attributes, options) {
|
||||
Backbone.Model.prototype.set.call(this, attributes, options);
|
||||
}
|
||||
set: function (attributes, options) {
|
||||
Backbone.Model.prototype.set.call(this, attributes, options);
|
||||
}
|
||||
});
|
||||
|
||||
note.get("title")
|
||||
|
||||
note.set({title: "March 20", content: "In his eyes she eclipses..."});
|
||||
note.set({ title: "March 20", content: "In his eyes she eclipses..." });
|
||||
|
||||
note.set("title", "A Scandal in Bohemia");
|
||||
|
||||
@@ -85,5 +85,9 @@ class EmployeeCollection extends Backbone.Collection {
|
||||
|
||||
url: string = "../api/employees";
|
||||
model = Employee;
|
||||
findByName(key) {}
|
||||
}
|
||||
findByName(key) { }
|
||||
}
|
||||
|
||||
//////////
|
||||
|
||||
Backbone.history.start();
|
||||
Reference in New Issue
Block a user