简体   繁体   中英

Set minimum width of chrome app

I am trying to set the minimum width of a chrome app and I looked at some chrome documention and I implemented it into my chrome app like this:

chrome.app.runtime.onLaunched.addListener(function(launchData) {
     chrome.app.window.create(
        'index.html',
        {
            id: 'mainWindow',
            bounds: {
                width: 800, 
                height: 600,
                minWidth: 600
            }
        }
    );
});

However I got the error:

Error Error in event handler for app.runtime.onLaunched: Error: Invalid value for argument 2. Property 'bounds.minWidth': Unexpected property.

From my knowledge, this means that the property doesn't exist but this can't be the case as it's in the documentation. Maybe I implemented it wrong? Any help would be appreciated!

I found out that it's innerBounds I needed to use! Here is my code now:

chrome.app.runtime.onLaunched.addListener(function(launchData) {
    chrome.app.window.create(
     'index.html',
{
      id: 'mainWindow',
      bounds: {width: 800, height: 600},
      innerBounds: { minWidth: 800}
    }
  );
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM