javascript - Chrome app - setBounds() deprecated -
now setbounds deprecated , how can replace code :
chrome.app.window.current().setbounds({width: aaa});
it says "use innerbounds or outerbounds."... how? every syntax try, error (object/number not function)
i had same problem , found solution looking @ 1 of samle apps called windowstate, can find here:
https://github.com/googlechrome/chrome-app-samples
to set position of window, can following:
chrome.app.window.current().outerbounds.setposition(positionleft,positiontop);
being positionleft , positiontop corresponding pixels.
what wanted positioning app window center of screen, did this
chrome.app.window.current().outerbounds.setposition(math.round(window.screen.availwidth*0.5-170),100);
you can see argument leftposition this:
math.round(window.screen.availwidth*0.5-170)
it user's screen width , set position 0.5 of available width minus half of window size. in case window size 340 that's why used 170. math round prevent invalid value, because position should in units.
the top position 100px.
hope helps.
javascript google-chrome
No comments:
Post a Comment