#WebStorm Live Template
###How to instal
For installing templates, you need, just copy all XML files to matching folder and restart WebStopm (PHPStorm)
-
Windows: [your home directory].[product name][version number]\config\templates
Example:
C:\Users\Windows-User\.WebStorm6\config\templates\
-
Linux: ~.[product name][version number]\config\templates
-
MacOS: ~/Library/Preferences/[product name][version number]/templates
define
- new full AMD module with name, dependensies and implementation. A directive/*global define:true*/
added for telling JSHint/JSLint about global variables.
/*global define:true*/
define('$MODULENAME$', [], function () {
'use strict';
$END$
return {};
});
dir
- Console dir() method
console.dir($PARAM$)
log
- Console log() method
console.log($PARAM$)
?
- Conditional operator that assigns a value to a variable based on some condition
$VAR$=($CONDITION$)?$VAL1$:$VAL2$
do
- Loop 'do-while' execute the code block once, before checking if the condition.
do {
$END$
} while ($CONDITION$);
for
- Loop 'for' with index
len = $ARRAY$.length;
for ($INDEX$ = 0; $INDEX$<len; $INDEX$ += 1) {
$VAR$ = $ARRAY$[$INDEX$];
$END$
}
forin
- Loop 'for-in' loops through the properties of an object
for (prop in $OBJ$) {
if ($OBJ$.hasOwnProperty(prop)) {
$END$
}
}
if
- 'if' statement
if ($CONDITION$) {
$END$
}
ife
- 'if-else' statement
if ($CONDITION$) {
$END$
} else {
}
ifeif
- 'if-else if -else' statement
if ($CONDITION$) {
$END$
} else if ($NEXTCONDITION$) {
} else {
}
switch
- 'switch' statement
switch ($EXPRESSION$) {
case $EXPVALUE1$:
$END$
break;
case $EXPVALUE2$:
break;
default:
}
throw
- Throw new error
throw new $ERRTYPE$('$MSG$', '$MODULENAME$');
try
- 'try-catch' statement
try {
$END$
} catch (err) {
}
while
- Loop 'while' loops through a block of code with condition
while ($CONDITION$) {
$END$
}
fn
- Create new function
function ($PARAMETERS$) {
'use strict';
var me = this;
$END$
}
seti
- The setInterval() method
setInterval($FUNC$, $PERIOD$);
sett
- The setTimeout() method
setInterval($FUNC$, $PERIOD$);
desc
- create new 'describe' function, group of tests
describe('$TESTNAME$', function () {
$END$
});
it
- create new 'it' function, implementation one test
it('$STATE$', function (done) {
$END$
done();
});