Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
Add Window status nested accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
Meiguro committed Mar 12, 2016
1 parent feb2526 commit 4f10252
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions src/js/ui/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ var actionProps = [

var accessorProps = configProps;

var nestedProps = [
'action',
'status',
];

var defaults = {
status: false,
backgroundColor: 'black',
Expand All @@ -62,6 +67,8 @@ util2.copy(Stage.prototype, Window.prototype);

Propable.makeAccessors(accessorProps, Window.prototype);

Propable.makeNestedAccessors(nestedProps, Window.prototype);

Window.prototype._id = function() {
return this.state.id;
};
Expand Down Expand Up @@ -141,28 +148,10 @@ Window.prototype._action = function(actionDef) {
}
};

Window.prototype.action = function(field, value, clear) {
var action = this.state.action;
if (!action) {
action = this.state.action = {};
}
if (arguments.length === 0) {
return action;
}
if (arguments.length === 1 && typeof field === 'string') {
return action[field];
}
if (typeof field !== 'string') {
clear = value;
}
if (clear) {
this._clear('action');
}
if (typeof field !== 'boolean') {
util2.copy(myutil.toObject(field, value), this.state.action);
Window.prototype._status = function(statusDef) {
if (this === WindowStack.top()) {
simply.impl.windowStatusBar(statusDef);
}
this._action(field);
return this;
};

var isBackEvent = function(type, subtype) {
Expand Down

0 comments on commit 4f10252

Please sign in to comment.