Skip to content

Instantly share code, notes, and snippets.

"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/index.js",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
{
"compilerOptions": {
"preserveConstEnums": true,
"strictNullChecks": true,
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"pretty": true,
"sourceMap": true,
"target": "es6",
onDeleteGoalEvent($event:any) {
this.goalService.remove(this.goal);
this.onTapped($event); // Call this to hide the goal editor
}
onDeleteEvent() {
this.goalService.remove(this.goalItem);
}
remove(goal: Goal): Promise<void> {
let index:number = GOALS.indexOf(goal);
if (index > -1) {
GOALS.splice(index, 1);
}
return Promise.resolve();
}
onCopyGoalEvent() {
this.goalService.clone(this.goal).then(goal => this.goal = goal) ;
}
onCopyEvent() {
this.goalService.clone(this.goalItem);
}
clone(goal: Goal): Promise<Goal> {
let clonedObject:Goal = goal.clone();
GOALS.push(clonedObject);
return Promise.resolve(clonedObject);
}
clone():Task {
return new Task({
title: this.title,
completed:this.completed,
percent:this.percent,
dueDate:this.dueDate,
completedAt:this.completedAt,
belongsTo:this.belongsTo,
showPercentage: this.showPercentage
});
clone():TaskCollection {
let cloneObject:TaskCollection = new TaskCollection();
for (let i=0; i<this.length; i++) {
let task:Task = this[i];
let cloneTask:Task = task.clone();
cloneObject.push(cloneTask);
}
return cloneObject;