Update coursewaresJSFramework_0.0.6.js
This commit is contained in:
@ -55,12 +55,16 @@ var codeStorage = {
|
|||||||
keyVersion:"saveVersion",
|
keyVersion:"saveVersion",
|
||||||
keyValue: challenge_Name + 'Val',
|
keyValue: challenge_Name + 'Val',
|
||||||
updateWait: 2000,// 2 seconds
|
updateWait: 2000,// 2 seconds
|
||||||
updateTimeoutId: null
|
updateTimeoutId: null,
|
||||||
|
eventArray: []//for saves
|
||||||
};
|
};
|
||||||
// Returns true if the editor code was saved since last key press (use this if you want to make a "saved" notification somewhere")
|
// Returns true if the editor code was saved since last key press (use this if you want to make a "saved" notification somewhere")
|
||||||
codeStorage.hasSaved = function(){
|
codeStorage.hasSaved = function(){
|
||||||
return ( updateTimeoutId === null );
|
return ( updateTimeoutId === null );
|
||||||
};
|
};
|
||||||
|
codeStorage.onSave = function(func){
|
||||||
|
codeStorage.eventArray.push(func);
|
||||||
|
};
|
||||||
codeStorage.getEditorValue = function(){
|
codeStorage.getEditorValue = function(){
|
||||||
return localStorage.getItem(codeStorage.keyValue);
|
return localStorage.getItem(codeStorage.keyValue);
|
||||||
};
|
};
|
||||||
@ -75,6 +79,9 @@ codeStorage.updateStorage = function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
codeStorage.updateTimeoutId = null;
|
codeStorage.updateTimeoutId = null;
|
||||||
|
codeStorage.eventArray.forEach(function(func){
|
||||||
|
func();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
// ANONYMOUS 1 TIME UPDATE VERSION
|
// ANONYMOUS 1 TIME UPDATE VERSION
|
||||||
(function(){
|
(function(){
|
||||||
|
Reference in New Issue
Block a user