achingbrain / bbq Goto Github PK
View Code? Open in Web Editor NEWJavascript Ninjery
Home Page: http://www.bbqjs.org
Javascript Ninjery
Home Page: http://www.bbqjs.org
Some documentation for "Updateables" would be really useful. I think these might allow for in place editing, which is what I'm actually looking for, but I'm not sure.
I've got a situation where it is desirable for a class to have a set of default options, so that the callee doesn't have to specify all options when creating an instance of the class.
I'm currently doing something like:
initialize: function($super, options) {
$super(options);
this.options = Object.extend({foo: 'bar'}, this.options);
}
I thought it would be nice if the root of the class hierarchy actually did this merge for me, if I defined a variable called "options" in my class. That way I save a bit of code and it also gives me a chance to explicitly state the class options (so that newcomers can easily see what options the class takes). The implementation would look something like:
var SuperClass = new Class.create({
initialize: function(options) {
this.options = Object.extend(this.options || {}, options);
}
});
var SubClass = new Class.create(SuperClass, {
options: {
val1: 'default',
val2: 'default'
},
initialize: function($super, options) {
$super(options);
}
});
var instance1 = new SubClass();
console.log('instance1.options.val1=' + instance1.options.val1);
console.log('instance1.options.val2=' + instance1.options.val2);
var instance2 = new SubClass({val2: 'foo'});
console.log('instance2.options.val1=' + instance1.options.val1);
console.log('instance2.options.val2=' + instance1.options.val2);
var instance3 = new SubClass({val1: 'foo', val2: 'foo'});
console.log('instance3.options.val1=' + instance1.options.val1);
console.log('instance3.options.val2=' + instance1.options.val2);
JavaScript tests still run...
If an entity has not "loaded", calling registerListener has the unexpected side effect of calling loadData if the event type is "onDataLoaded".
Whilst I agree that the callback should be called immediately if the object is loaded, I don't agree with the side effect. My initial reaction was to register the listener and then call loadData explicitly when I wanted to start the load.
Also, just another minor point: This method is documented as private - should it be? If so then it should probably start with an underscore to follow convention and if not we should get rid of the annotation so that it appears in the jsdocs.
There is a private function "_loaded" which seems to start a periodic check (and fire the event if loaded), but it doesn't seem to be called anywhere.
console.dir lists the properties of the object you pass it. Log.dir does not, because toString is called on the object to log before being passed to console.dir.
Would it be possible for CSS files to be named package/path/ClassName.css rather than package/path/ClassName/style.css. It would certainly make it easier to bring up the relevant CSS file for a class when using cmd+shift+n in Intellij.
It would be nice to be able to set multiple styles a la Prototypejs by passing an object to the setStyle method of GUIWidget/DOMUtil.
What do you think?
I'm having trouble understanding the loop at the end of this method:
if(this._entities[i].equals(data))
If the stored entity at index "i" equals data then...
data = this.get(i);
Set data equal to the entity in the repository
data.processData(data.options.data);
Get the entity to process the data it already has...
So, basically it throws away the new version of the entity - in my case it uses the partially loaded entity over the JSON I pass to Repository.add.
Could you explain, or is this a bug?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.