以前に、境界を に設定するコードを使用して、名前付きのシングルトン ウィンドウを開きました{ width: 1200, height: 600 }
。その後、コードを変更し、Chrome でアプリを更新しましたが、開くと以前のサイズが引き続き使用されます。別のサイズを使用する唯一の方法は、別の名前を付けることです。同じ名前を使用して寸法を変更するにはどうすればよいですか?
最初に使用したバージョン
var screenWidth = screen.availWidth;
var screenHeight = screen.availHeight;
var width = 1200;
var height = 600;
//Create the app window
chrome.app.window.create(
'options.html',
{
frame: "none",
bounds:
{
width: width,
height: height,
left: Math.round((screenWidth-width)/2),
top: Math.round((screenHeight-height)/2)
},
id: "optionsWindow",
singleton: true
}
);
使用したアプリの更新バージョン:
var screenWidth = screen.availWidth;
var screenHeight = screen.availHeight;
var width = 700;
var height = 600;
//Create the app window
chrome.app.window.create(
'options.html',
{
frame: "none",
bounds:
{
width: width,
height: height,
left: Math.round((screenWidth-width)/2),
top: Math.round((screenHeight-height)/2)
},
id: "optionsWindow",
singleton: true
}
);
どちらの場合も、幅は 1200 ピクセルです。名前を変更した場合にのみ"optionsWindow2"
、新しいサイズとして表示されます。
より詳しい情報
関数にコールバックを渡し、create
そこで AppWindow フォームを使用しようとすると、null であり、chrome.app.window
!によって開かれていないと表示されます。以前に作成したことのない新しいウィンドウを作成した場合 (たとえばoptionsWindow3
、コールバックは有効な AppWindow を返します! これはなぜですか?