Skip to content

Instantly share code, notes, and snippets.

@codeBelt
Last active December 31, 2015 18:19
Show Gist options
  • Select an option

  • Save codeBelt/8025801 to your computer and use it in GitHub Desktop.

Select an option

Save codeBelt/8025801 to your computer and use it in GitHub Desktop.
StructureTS PhpStorm/WebStorm Templates
///<reference path='replace/path/${Extends}.ts'/>
module ${Namespace} {
import ${Extends} = StructureTS.${Extends};
/**
* YUIDoc_comment
*
* @class ${NAME}
* @extends ${Extends}
* @module ${Namespace}
* @constructor
**/
export class ${NAME} extends ${Extends} {
constructor() {
super();
}
}
}
/**
* YUIDoc_comment
*
* @method $name$
* @$accessType$
*/
$accessType$ $name$($param$):void {
}
/**
* YUIDoc_comment
*
* @property $name$
* @type {$type$}
* @$accessType$
*/
$accessType$ $name$:$type$ = null;
///<reference path='com/codebelt/structurets/model/ValueObject.ts'/>
///<reference path='com/codebelt/structurets/interface/IValueObject.ts'/>
module ${Namespace} {
import ValueObject = StructureTS.ValueObject;
import IValueObject = StructureTS.IValueObject;
/**
* YUIDoc_comment
*
* @class ${NAME}
* @param [data] {any} Provide a way to update the value object upon initialization.
* @extends ValueObject
* @module ${Namespace}
* @constructor
**/
export class ${NAME} extends ValueObject {
constructor(data:any = null) {
super();
if (data) {
this.update(data);
}
}
/**
* @overridden ValueObject.update
*/
public update(data:any):void {
}
/**
* @overridden ValueObject.copy
*/
public copy():${NAME} {
var data:IValueObject = super.copy();
return new ${NAME}(data);
}
}
}
///<reference path='replace/path/${Extends}.ts'/>
module ${Namespace} {
import ${Extends} = StructureTS.${Extends};
/**
* YUIDoc_comment
*
* @class ${NAME}
* @extends ${Extends}
* @module ${Namespace}
* @constructor
**/
export class ${NAME} extends ${Extends} {
constructor() {
super();
}
/**
* @overridden ${Extends}.createChildren
*/
public createChildren():void {
super.createChildren();
// Create and add your child objects to this parent class.
}
/**
* @overridden ${Extends}.layoutChildren
*/
public layoutChildren():void {
// Layout or update the child objects in this parent class.
}
/**
* @overridden ${Extends}.enable
*/
public enable():void {
if (this.isEnabled === true) return;
// Enable the child objects and add any event listeners.
super.enable();
}
/**
* @overridden ${Extends}.disable
*/
public disable():void {
if (this.isEnabled === false) return;
// Disable the child objects and remove any event listeners.
super.disable();
}
/**
* @overridden ${Extends}.destroy
*/
public destroy():void {
super.destroy();
// Destroy the child objects and references in this parent class to prevent memory leaks.
}
}
}
///<reference path='$path$'/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment