私は次のJavaScriptオブジェクトリテラル通知オブジェクトを持っています
var Parameters= {
modal_window:{
backdrop:true,
keyboard:true,
show:true,
remote:false,
type:{
normal:function(){
this.footer.button.accept.type='btn btn-primary';
this.header.type='modal-header';
},
success:function(){
this.footer.button.accept.type='btn btn-success';
this.header.type='modal-header alert alert-success';
},
info:function(){
this.footer.button.accept.type='btn btn-info';
this.header.type='modal-header alert alert-info';
},
error:function(){
this.footer.button.accept.type='btn btn-danger';
this.header.type='modal-header alert alert-error';
},
warning:function(){
this.footer.button.accept.type='btn btn-warning';
this.header.type='modal-header alert';
}
}
},
header:{
title:undefined,
type:this.window.type.normal.header
},
footer:{
button:
{
accept:{
title:'Accept',
click:undefined,
type:undefined
},
cancel:{
title:'Cancel',
click:undefined
}
}
}
};
header.type と footer.button.accept.type を、window.type.normal、window.type.success などでのみ変更できる読み取り専用変数にすることはできますか?
明確化: ここでいくつか明確化したいと思います。私の Parameters.header.type は読み取り専用で、デフォルト値を持つ必要があります。たとえば、ユーザーが Parameters.modal_window.type.normal を選択すると、Parameters.header.type を変更する必要があります。