Skip to content

Instantly share code, notes, and snippets.

@RangerRick
Created July 30, 2019 15:43
Show Gist options
  • Save RangerRick/0d5de383f186d34abbff2ed8003d82cd to your computer and use it in GitHub Desktop.
Save RangerRick/0d5de383f186d34abbff2ed8003d82cd to your computer and use it in GitHub Desktop.
{
"presets": [
["@babel/preset-env", {
"targets": {
"node": "current",
"browsers": [ "last 2 versions", "safari >= 7", "> 5%" ]
},
"modules": "umd",
"useBuiltIns": "usage",
"corejs": 2
}],
"@babel/preset-typescript"
],
"plugins": [
"angularjs-annotate",
["module-resolver", {
"root": [
"src/main/assets/modules",
"src/main/assets/js",
"src/main/assets/style",
"node_modules"
]
}],
["@babel/plugin-transform-runtime", {
"corejs": 2,
"helpers": false,
"regenerator": true
}],
"@babel/plugin-proposal-async-generator-functions",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-destructuring",
"@babel/plugin-transform-for-of",
"@babel/plugin-transform-modules-commonjs",
"@babel/plugin-transform-regenerator"
]
}
abstract class ParentClass {
private hash?: string;
constructor() {
this.generateHash();
}
protected generateHash() {
this.hash = Math.random().toString(6);
this.onNewHash(this.hash);
}
protected onNewHash(newHash?: string) {
}
}
class SubClass extends ParentClass {
public computedString?: string;
constructor() {
super();
}
protected onNewHash(newHash?: string) {
super.onNewHash(newHash);
this.computedString = 'Basic ' + newHash;
}
}
const sc = new SubClass();
console.log(sc.computedString);
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"sourceMap": true,
"allowJs": true,
"lib": [ "es6", "dom" ],
"skipLibCheck": true,
"outDir": "dist"
},
"include": [
"src"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment