-
Notifications
You must be signed in to change notification settings - Fork 831
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7461 from surveyjs/issue/7443-Signature-Pad---Upl…
…oading-to-a-Storage---Unexpected-behavior-on-an-attempt-to-submit-a-survey-without-sending-a-signature-to-the-server-first Issue/7443-Signature-Pad---Uploading-to-a-Storage---Unexpected-behavior-on-an-attempt-to-submit-a-survey-without-sending-a-signature-to-the-server-first
- Loading branch information
Showing
12 changed files
with
155 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { ISurvey } from "./base-interfaces"; | ||
import { Base, EventBase } from "./base"; | ||
import { SurveyTimer } from "./surveytimer"; | ||
import { property } from "./jsonobject"; | ||
import { PageModel } from "./page"; | ||
import { SurveyModel } from "./survey"; | ||
import { CssClassBuilder } from "./utils/cssClassBuilder"; | ||
|
||
class SurveyTaskModel { | ||
private timestamp: Date; | ||
constructor(public type: string) { | ||
this.timestamp = new Date(); | ||
} | ||
} | ||
|
||
export class SurveyTaskManagerModel extends Base { | ||
private taskList: SurveyTaskModel[] = []; | ||
constructor() { | ||
super(); | ||
} | ||
|
||
private onAllTasksCompleted: EventBase<SurveyTaskManagerModel> = this.addEvent<SurveyTaskManagerModel>(); | ||
//@property() text: string; | ||
@property({ defaultValue: false }) hasActiveTasks: boolean; | ||
|
||
public runTask(type: string, func: (done: any) => void): SurveyTaskModel { | ||
const task = new SurveyTaskModel(type); | ||
this.taskList.push(task); | ||
this.hasActiveTasks = true; | ||
func(() => this.taskFinished(task)); | ||
return task; | ||
} | ||
|
||
public waitAndExecute(action: any) { | ||
if(!this.hasActiveTasks) { | ||
action(); | ||
return; | ||
} | ||
this.onAllTasksCompleted.add(()=> { action(); }); | ||
} | ||
|
||
private taskFinished(task: SurveyTaskModel) { | ||
const index = this.taskList.indexOf(task); | ||
if (index > -1) { | ||
this.taskList.splice(index, 1); | ||
} | ||
if(this.hasActiveTasks && this.taskList.length == 0) { | ||
this.hasActiveTasks = false; | ||
this.onAllTasksCompleted.fire(this, {}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters