klenwell information services : JavascriptStyleGuide

Revision history for JavascriptStyleGuide


Revision [3068]

Last edited on 2016-07-09 16:54:44 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
Modules should use the [[http://learn.jquery.com/code-organization/concepts/#the-module-pattern | jQuery module pattern]]:
Deletions:
Modules should use the [[http://learn.jquery.com/code-organization/concepts/#the-module-pattern jQuery module pattern]]:


Revision [2767]

Edited on 2014-06-17 20:10:25 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
var self = {};
self.foo = foo;
console.debug('foo', self.foo);
Deletions:
this._foo = foo;
console.debug('foo', this._foo);


Revision [2764]

Edited on 2014-06-17 07:44:32 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
var MinFoo = (function() {
var init = function(foo) {
this._foo = foo;
var foo = function() {
console.debug('foo', this._foo);
init: init,
foo: foo
MinFoo.init('hello');
MinFoo.foo();
Deletions:
var BrowserCache = (function() {
var ENGINE = localStorage;
var setValue = function(key, value) {
var jsonValue = JSON.stringify(value);
ENGINE.setItem(key, jsonValue);
var getValue = function(key) {
return JSON.parse(ENGINE.getItem(key));
set: setValue,
get: getValue


Revision [2759]

Edited on 2014-06-15 22:11:33 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
Object-oriented classes requiring classical inheritance should use the augment pattern:
function augment(parent, properties) {
var child = properties.constructor || function() {
return parent.apply(this, arguments);
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate;
for (var key in properties) {
child.prototype[key] = properties[key];
return child;
};
var MinObject = augment(Object, {
constructor: function(debug) {
this.debug = (debug !== undefined) ? debug : false;
this.logDebug('init MinStateMachine with state:', this.state);
},
logDebug: function() {
if ( this.debug ) {
var args = Array.prototype.slice.call(arguments, 0);
console.debug(args.join(' '));
}
},
});
%%
Deletions:
Object-oriented classes requiring classical inheritance should use the augment pattern.


Revision [2758]

Edited on 2014-06-15 22:09:20 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
%%(javascript)
Deletions:
%%


Revision [2757]

The oldest known version of this page was created on 2014-06-15 22:08:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]