javascript - How to move a window after restart with the window API for chrome app? -
as mentioned here: https://developer.chrome.com/apps/app_window#method-create
if use id's windows (as need if don't start app twice) position size getting stored. , advice create window hidden move , re-size before showing.
if try create window on particular screen this:
var left = parseint(displayinfo.workarea.left); chrome.app.window.create('index.html', { id: 'window-'+displayinfo.id, hidden: true, bounds: {left: left, top: 0, width: 100 , height: 100 } , callbackwindow.bind(null, left, 0, displayinfo)); var callbackwindow = function (left, top, displayinfo, createdwindow) { createdwindow.moveto(displayinfo.workarea.left, displayinfo.workarea.top); console.log(createdwindow.id, createdwindow.getbounds()); createdwindow.show(); }; the first time application starts window on correct position, if move window , re-size , restart app. stay on same potion before closing.
in other words, can not override stored position. bug or should work this?
i've made tests on windows 7 chrome 32.0.1700.107 dev-m
moveto standard dom moveto. appwindow object forwards moveto , resizeto functions window object.
what happens if try use appwindow.setbounds instead? i'm guessing, haven't tested, dom functions being ignored window not visible.
also, using old version of chrome. think current stable version 34.
Comments
Post a Comment