JetBrains LiveTemplate for AngularJS Decorators
The snippet can be accessed without any authentication.
Authored by
Jonas Mai
Quickly extend a given Services method. The file where you use this template needs to be named originalServiceNameDecorator.js
ngdecorator.xml 913 B
<template name="ngd" value="'use strict'; export default function $fileName$($delegate, $injector) { const original$methodToAugmentCap$ = $delegate.$methodToAugment$.bind($delegate); $delegate.$methodToAugment$ = function () { original$methodToAugmentCap$(); $yourAddedFun$ }; return $delegate; }" description="Decoratorpattern for AngularJS services." toReformat="false" toShortenFQNames="true">
<variable name="fileName" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" />
<variable name="methodToAugment" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="methodToAugmentCap" expression="capitalize(methodToAugment)" defaultValue="" alwaysStopAt="false" />
<variable name="yourAddedFun" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
Please register or sign in to comment