On Wed, Jan 15, 2014 at 02:53:00PM -0200, Jesus Sanchez-Palencia wrote: > The only idea we had was to change a bit how the JS shim is > implemented. I would do something like: > > " > var orientationValue = ""; > > Object.defineProperty(window.screen, "orientation", { > configurable: false, > enumerable: true, > get: function() { > if (orientationValue === "") { > var msg = JSON.stringify({'cmd' : 'GetScreenOrientation'}); > var result = extension.internal.sendSyncMessage(msg); > orientationValue = JSON.parse(result); > } > > return orientationValue; > }, > }); > "
I agree with Jesus analysis here. Note that in his example, you would need to add extra logic to ensure that screen orientation changed update orientationValue. One alternative route is available if you already have this information inside Render Process, in that case you can use a native function exposed to JavaScript to access this information. See v8tools example or other examples implementing XWalkNativeModule. However, it will only work if you ensure that the RP have the information about rotation before we are able to run the web content JS code. Cheers, Caio _______________________________________________ Crosswalk-dev mailing list Crosswalk-dev@lists.crosswalk-project.org https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev