Plugin Keys: Add comments on new functions
This commit is contained in:
parent
85ce464728
commit
83e1c51a28
@ -87,6 +87,7 @@ window.plugin.keys.delaySync = function() {
|
|||||||
}, plugin.keys.SYNC_DELAY);
|
}, plugin.keys.SYNC_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store the upadteQueue in updatingQueue and upload
|
||||||
window.plugin.keys.syncNow = function() {
|
window.plugin.keys.syncNow = function() {
|
||||||
if(!plugin.keys.enableSync) return;
|
if(!plugin.keys.enableSync) return;
|
||||||
$.extend(plugin.keys.updatingQueue, plugin.keys.updateQueue);
|
$.extend(plugin.keys.updatingQueue, plugin.keys.updateQueue);
|
||||||
@ -97,18 +98,22 @@ window.plugin.keys.syncNow = function() {
|
|||||||
plugin.sync.updateMap('keys', 'keys', Object.keys(plugin.keys.updatingQueue));
|
plugin.sync.updateMap('keys', 'keys', Object.keys(plugin.keys.updatingQueue));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called after IITC and all plugin loaded
|
// Call after IITC and all plugin loaded
|
||||||
window.plugin.keys.registerFieldForSyncing = function() {
|
window.plugin.keys.registerFieldForSyncing = function() {
|
||||||
if(!window.plugin.sync) return;
|
if(!window.plugin.sync) return;
|
||||||
window.plugin.sync.registerMapForSync('keys', 'keys', window.plugin.keys.syncCallback, window.plugin.keys.syncInitialed);
|
window.plugin.sync.registerMapForSync('keys', 'keys', window.plugin.keys.syncCallback, window.plugin.keys.syncInitialed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call after local or remote change uploaded
|
||||||
window.plugin.keys.syncCallback = function(pluginName, fieldName, e, fullUpdated) {
|
window.plugin.keys.syncCallback = function(pluginName, fieldName, e, fullUpdated) {
|
||||||
if(fieldName === 'keys') {
|
if(fieldName === 'keys') {
|
||||||
plugin.keys.storeLocal(plugin.keys.KEY);
|
plugin.keys.storeLocal(plugin.keys.KEY);
|
||||||
|
// All data is replaced if other client update the data duing this client offline,
|
||||||
|
// fire 'pluginKeysRefreshAll' to notify a full update
|
||||||
if(fullUpdated) {
|
if(fullUpdated) {
|
||||||
plugin.keys.updateDisplayCount();
|
plugin.keys.updateDisplayCount();
|
||||||
window.runHooks('pluginKeysRefreshAll');
|
window.runHooks('pluginKeysRefreshAll');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!e) return;
|
if(!e) return;
|
||||||
@ -125,7 +130,7 @@ window.plugin.keys.syncCallback = function(pluginName, fieldName, e, fullUpdated
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// syncing of the field is initialed
|
// syncing of the field is initialed, upload all queued update
|
||||||
window.plugin.keys.syncInitialed = function(pluginName, fieldName) {
|
window.plugin.keys.syncInitialed = function(pluginName, fieldName) {
|
||||||
if(fieldName === 'keys') {
|
if(fieldName === 'keys') {
|
||||||
plugin.keys.enableSync = true;
|
plugin.keys.enableSync = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user