var privUtils_ = xwalk.utils;
var Property = {
- W: 1 << 0, // WRITABLE
- E: 1 << 1, // ENUMERABLE
- C: 1 << 2 // CONFIGURABLE
+ WRITEABLE: 1 << 0,
+ ENUMERABLE: 1 << 1,
+ CONFIGURABLE: 1 << 2
};
function addTypeToFilter_(data) {
if (!options.get && !options.set) {
options.value = value;
}
- if ((flags & Property.W) != 0) {
+ if ((flags & Property.WRITEABLE) != 0) {
options.writable = true;
}
- if ((flags & Property.E) != 0) {
+ if ((flags & Property.ENUMERABLE) != 0) {
options.enumerable = true;
}
- if ((flags & Property.C) != 0) {
+ if ((flags & Property.CONFIGURABLE) != 0) {
options.configurable = true;
}
Object.defineProperty(that, name, options);
if (data === null || typeof data !== 'object') {
data = {};
}
- propertyFactory_(this, 'subject', data.subject || '', Property.E | Property.W);
- propertyFactory_(this, 'to', data.to || [], Property.E | Property.W);
- propertyFactory_(this, 'cc', data.cc || [], Property.E | Property.W);
- propertyFactory_(this, 'bcc', data.bcc || [], Property.E | Property.W);
- propertyFactory_(this, 'plainBody', data.plainBody || '', Property.E | Property.W);
- propertyFactory_(this, 'htmlBody', data.htmlBody || '', Property.E | Property.W);
+ propertyFactory_(this, 'subject', data.subject || '', Property.ENUMERABLE | Property.WRITEABLE);
+ propertyFactory_(this, 'to', data.to || [], Property.ENUMERABLE | Property.WRITEABLE);
+ propertyFactory_(this, 'cc', data.cc || [], Property.ENUMERABLE | Property.WRITEABLE);
+ propertyFactory_(this, 'bcc', data.bcc || [], Property.ENUMERABLE | Property.WRITEABLE);
+ propertyFactory_(this, 'plainBody', data.plainBody || '', Property.ENUMERABLE | Property.WRITEABLE);
+ propertyFactory_(this, 'htmlBody', data.htmlBody || '', Property.ENUMERABLE | Property.WRITEABLE);
propertyFactory_(
this,
'isHighPriority',
data.isHighPriority || false,
- Property.E | Property.W
+ Property.ENUMERABLE | Property.WRITEABLE
);
}
function MessageStorage() {}
function MessageService(data) {
- propertyFactory_(this, 'id', data.id, Property.E);
- propertyFactory_(this, 'type', data.type, Property.E);
- propertyFactory_(this, 'name', data.name, Property.E);
- propertyFactory_(this, 'messageStorage', new MessageStorage(this), Property.E);
+ propertyFactory_(this, 'id', data.id, Property.ENUMERABLE);
+ propertyFactory_(this, 'type', data.type, Property.ENUMERABLE);
+ propertyFactory_(this, 'name', data.name, Property.ENUMERABLE);
+ propertyFactory_(this, 'messageStorage', new MessageStorage(this), Property.ENUMERABLE);
}
MessageService.prototype.sendMessage = function() {
};
function MessageConversation(data) {
- propertyFactory_(this, 'id', data.id || null, Property.E);
- propertyFactory_(this, 'type', data.type || '', Property.E);
+ propertyFactory_(this, 'id', data.id || null, Property.ENUMERABLE);
+ propertyFactory_(this, 'type', data.type || '', Property.ENUMERABLE);
propertyFactory_(
this,
'timestamp',
data.timestamp ? new Date(data.timestamp * 1000) : null,
- Property.E
+ Property.ENUMERABLE
);
- propertyFactory_(this, 'messageCount', data.messageCount || 0, Property.E);
- propertyFactory_(this, 'unreadMessages', data.unreadMessages || 0, Property.E);
- propertyFactory_(this, 'preview', data.preview || '', Property.E);
- propertyFactory_(this, 'subject', data.subject || '', Property.E);
- propertyFactory_(this, 'isRead', data.isRead || false, Property.E);
- propertyFactory_(this, 'from', data.from || null, Property.E);
- propertyFactory_(this, 'to', data.to || [], Property.E);
- propertyFactory_(this, 'cc', data.cc || [], Property.E);
- propertyFactory_(this, 'bcc', data.bcc || [], Property.E);
- propertyFactory_(this, 'lastMessageId', data.lastMessageId || null, Property.E);
+ propertyFactory_(this, 'messageCount', data.messageCount || 0, Property.ENUMERABLE);
+ propertyFactory_(this, 'unreadMessages', data.unreadMessages || 0, Property.ENUMERABLE);
+ propertyFactory_(this, 'preview', data.preview || '', Property.ENUMERABLE);
+ propertyFactory_(this, 'subject', data.subject || '', Property.ENUMERABLE);
+ propertyFactory_(this, 'isRead', data.isRead || false, Property.ENUMERABLE);
+ propertyFactory_(this, 'from', data.from || null, Property.ENUMERABLE);
+ propertyFactory_(this, 'to', data.to || [], Property.ENUMERABLE);
+ propertyFactory_(this, 'cc', data.cc || [], Property.ENUMERABLE);
+ propertyFactory_(this, 'bcc', data.bcc || [], Property.ENUMERABLE);
+ propertyFactory_(this, 'lastMessageId', data.lastMessageId || null, Property.ENUMERABLE);
}
function MessageFolder(data) {