Enable change events in the drive

This commit is contained in:
yflory
2017-12-05 18:09:43 +01:00
parent 17636769e4
commit 9eb33e39e6
7 changed files with 59 additions and 29 deletions

View File

@@ -99,7 +99,10 @@ define([
common.userObjectCommand = function (data, cb) {
postMessage("DRIVE_USEROBJECT", data, cb);
};
common.onDriveLog = Util.mkEvent();
common.drive = {};
common.drive.onLog = Util.mkEvent();
common.drive.onChange = Util.mkEvent();
common.drive.onRemove = Util.mkEvent();
// Profile
common.getProfileEditUrl = function (cb) {
postMessage("GET", ['profile', 'edit'], function (obj) {
@@ -649,7 +652,13 @@ define([
}
// Drive
case 'DRIVE_LOG': {
common.onDriveLog.fire(data);
common.drive.onLog.fire(data);
}
case 'DRIVE_CHANGE': {
common.drive.onChange.fire(data);
}
case 'DRIVE_REMOVE': {
common.drive.onRemove.fire(data);
}
}
};
@@ -696,7 +705,8 @@ define([
anonHash: LocalStore.getFSHash(),
localToken: tryParsing(localStorage.getItem(Constants.tokenKey)),
language: common.getLanguage(),
messenger: rdyCfg.messenger
messenger: rdyCfg.messenger,
driveEvents: rdyCfg.driveEvents
};
if (sessionStorage[Constants.newPadPathKey]) {
cfg.initialPath = sessionStorage[Constants.newPadPathKey];