babeljs: step 2

This commit is contained in:
RainLoop Team 2015-11-18 20:32:29 +03:00
parent 007a03b8d4
commit 53cf543795
74 changed files with 2551 additions and 2963 deletions

View file

@ -1,82 +0,0 @@
(function () {
'use strict';
var
ko = require('ko'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Settings = require('Storage/Settings'),
AppStore = require('Stores/App')
;
/**
* @constructor
*/
function AppUserStore()
{
AppStore.call(this);
this.currentAudio = ko.observable('');
this.focusedState = ko.observable(Enums.Focused.None);
this.focusedState.subscribe(function (mValue) {
switch (mValue)
{
case Enums.Focused.MessageList:
Globals.keyScope(Enums.KeyState.MessageList);
break;
case Enums.Focused.MessageView:
Globals.keyScope(Enums.KeyState.MessageView);
break;
case Enums.Focused.FolderList:
Globals.keyScope(Enums.KeyState.FolderList);
break;
}
}, this);
this.projectHash = ko.observable('');
this.threadsAllowed = ko.observable(false);
this.composeInEdit = ko.observable(false);
this.contactsAutosave = ko.observable(false);
this.useLocalProxyForExternalImages = ko.observable(false);
this.contactsIsAllowed = ko.observable(false);
this.attachmentsActions = ko.observableArray([]);
this.devEmail = '';
this.devPassword = '';
}
AppUserStore.prototype.populate = function()
{
AppStore.prototype.populate.call(this);
this.projectHash(Settings.settingsGet('ProjectHash'));
this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
var mAttachmentsActions = Settings.settingsGet('AttachmentsActions');
this.attachmentsActions(Utils.isNonEmptyArray(mAttachmentsActions) ? mAttachmentsActions : []);
this.devEmail = Settings.settingsGet('DevEmail');
this.devPassword = Settings.settingsGet('DevPassword');
};
module.exports = new AppUserStore();
}());

72
dev/Stores/User/App.jsx Normal file
View file

@ -0,0 +1,72 @@
import ko from 'ko';
import {Focused, KeyState} from 'Common/Enums';
import Globals from 'Common/Globals';
import Utils from 'Common/Utils';
import Settings from 'Storage/Settings';
import {AbstractAppStore} from 'Stores/AbstractApp';
class AppUserStore extends AbstractAppStore
{
constructor()
{
super();
this.currentAudio = ko.observable('');
this.focusedState = ko.observable(Focused.None);
this.focusedState.subscribe(function (value) {
switch (value)
{
case Focused.MessageList:
Globals.keyScope(KeyState.MessageList);
break;
case Focused.MessageView:
Globals.keyScope(KeyState.MessageView);
break;
case Focused.FolderList:
Globals.keyScope(KeyState.FolderList);
break;
}
}, this);
this.projectHash = ko.observable('');
this.threadsAllowed = ko.observable(false);
this.composeInEdit = ko.observable(false);
this.contactsAutosave = ko.observable(false);
this.useLocalProxyForExternalImages = ko.observable(false);
this.contactsIsAllowed = ko.observable(false);
this.attachmentsActions = ko.observableArray([]);
this.devEmail = '';
this.devPassword = '';
}
populate() {
super.populate();
this.projectHash(Settings.settingsGet('ProjectHash'));
this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
const attachmentsActions = Settings.settingsGet('AttachmentsActions');
this.attachmentsActions(Utils.isNonEmptyArray(attachmentsActions) ? attachmentsActions : []);
this.devEmail = Settings.settingsGet('DevEmail');
this.devPassword = Settings.settingsGet('DevPassword');
};
}
module.exports = new AppUserStore();

View file

@ -1,28 +0,0 @@
(function () {
'use strict';
var
_ = require('_'),
ko = require('ko')
;
/**
* @constructor
*/
function IdentityUserStore()
{
this.identities = ko.observableArray([]);
this.identities.loading = ko.observable(false).extend({'throttle': 100});
this.identitiesIDS = ko.computed(function () {
return _.compact(_.map(this.identities(), function (oItem) {
return oItem ? oItem.id : null;
}));
}, this);
}
module.exports = new IdentityUserStore();
}());

View file

@ -0,0 +1,18 @@
import {_} from 'common';
import ko from 'ko';
class IdentityUserStore
{
constructor()
{
this.identities = ko.observableArray([]);
this.identities.loading = ko.observable(false).extend({'throttle': 100});
this.identitiesIDS = ko.computed(() => {
return _.compact(_.map(this.identities(), (item) => item ? item.id : null));
}, this);
}
}
module.exports = new IdentityUserStore();

View file

@ -703,7 +703,7 @@
Cache.initMessageFlagsFromCache(oMessage);
if (oMessage.unseen() || oMessage.hasUnseenSubMessage())
{
require('App/User').messageListAction(oMessage.folderFullNameRaw,
require('App/User').default.messageListAction(oMessage.folderFullNameRaw,
oMessage.uid, Enums.MessageSetAction.SetSeen, [oMessage]);
}
@ -928,7 +928,7 @@
if (oFolder && (bCached || bUnreadCountChange || SettingsStore.useThreads()))
{
require('App/User').folderInformation(oFolder.fullNameRaw, aList);
require('App/User').default.folderInformation(oFolder.fullNameRaw, aList);
}
}
else