Skip to content

Commit

Permalink
Merge c780464 into 3b51d82
Browse files Browse the repository at this point in the history
  • Loading branch information
BarbourSmith committed Aug 14, 2020
2 parents 3b51d82 + c780464 commit 6caffd5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/js/githubOauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,8 @@ export default function GitHubModule(){
*/
this.loadProject = async function(projectName){

GlobalVariables.startTime = new Date().getTime()

if(typeof intervalTimer != undefined){
clearInterval(intervalTimer) //Turn off auto saving
}
Expand Down Expand Up @@ -1064,8 +1066,6 @@ export default function GitHubModule(){
GlobalVariables.circleSegmentSize = rawFile.circleSegmentSize
}

intervalTimer = setInterval(() => this.saveProject(), 120000) //Save the project regularly

if(rawFile.filetypeVersion == 1){
GlobalVariables.topLevelMolecule.deserialize(rawFile)
}
Expand All @@ -1082,6 +1082,7 @@ export default function GitHubModule(){
document.getElementById("pull_top").style.display = "none"
}
})

}

this.convertFromOldFormat = function(json){
Expand Down Expand Up @@ -1119,6 +1120,13 @@ export default function GitHubModule(){
return projectObject
}

/**
* Begins the automatic process of saving the project
*/
this.beginAutosave = function(){
intervalTimer = setInterval(() => this.saveProject(), 120000) //Save the project regularly
}

/**
* Loads a project from github by its github ID.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/js/molecules/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ export default class Output extends Atom {
this.parent.propogate()
this.parent.processing = false

if(this.parent.topLevel){
const timeToLoad = (new Date().getTime() - GlobalVariables.startTime)/1000
console.warn("Loading finished in " + timeToLoad + " seconds")

GlobalVariables.gitHub.beginAutosave()
}

//Remove all the information stored in github molecules with no inputs after they have been computed to save ram
// if(this.parent.inputs.length == 0 && this.parent.atomType == "GitHubMolecule" && !this.parent.topLevel){
// this.parent.dumpBuffer(true)
Expand Down

0 comments on commit 6caffd5

Please sign in to comment.