OK, I see. I had expected something a bit more thought out already.

Maybe model it after navigator.getGamepads, or the even newer
navigator.getVRDiaplay (which is modelled after the former somehow):

interface Keyboard {
    readonly attribute boolean isConnected;
    readonly attribute boolean isPrimary;
    readonly attribute boolean isPhysical;
    readonly attribute boolean isDetachable;
};

partial interface Navigator (ie. Crosswalk) {
   Promise<sequence<Keyboard>> getKeyboards();
   Keyboard getPrimaryKeyboard();
}

partial interface Window (ie. Crosswalk) {
  attribute EventHandler onkeyboardconnected;
  attribute EventHandler onkeyboarddisconnected;
  attribute EventHandler onprimarykeyboardchange;
};


getPrimaryKeyboard().isPhysical will be enough to know whether it is in
tablet mode or not, or whether it is a laptop. You can subscribe to
"primarykeyboardchange" event to know when state changes.

On Tue, Jun 7, 2016 at 11:11 AM Staudinger, Robert <
robert.staudin...@intel.com> wrote:

> On 7 June 2016 at 09:55, Kenneth Rohde Christiansen
> <kenneth.christian...@gmail.com> wrote:
> > Is there any design document, showing the potential APIs etc?
>
> We are providing low level primitives that can be used in conjunction
> with other APIs (gyro, rotation, ...)
>
> The initial API is along the lines of (pseudo-idl)
>
> interface Crosswalk.twoinone {
>     boolean haveKeyboard();
>     boolean keyboardStatusChanged(callback);
> };
>
_______________________________________________
Crosswalk-dev mailing list
Crosswalk-dev@lists.crosswalk-project.org
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

Reply via email to