JS in Glass

Android on my Face

Google Glass

Glass Timeline

[settings] [now] ["ok glass"] [more stuff] [back][in][time][.]

                 [google] [take a picture] [record ...


{
  "text": "Thanks for attending JS.everywhere(2013)",
  "notification": {
    "level": "DEFAULT"
  }
}
              

{ "html": '...'},
  "notification": {
    "level": "DEFAULT"
  }
}
              

<article>
  <section>
    <p class="text-auto-size">It has been a real 
      <strong class="yellow">pleasure</strong>
      to host this event. I hope that <em class="blue">you</em>
      have enjoyed yourself.</p>
  </section>
</article>
              

{
  "menuItems": [
    {"action": "SHARE"},
    {"action": "DELETE"},
    {"action": "TOGGLE_PINNED"}
  ],
  "notification": {
    "level": "DEFAULT"
  }
}
              

Let me show you all how it works...

Lyle Troxell

Developer Advocate for wakandaDB


@lyle Twitter & Github

http://GeekSpeak.org

Meetings with Strangers


glass.wakanda.org

Google APIs & wakandaDB

Google OAuth2

OAuth2 - Google - Wakanda

ComondJS module

https://github.com/lyle/wakanda-googleOAuth2-client

Register Your App

  • client_id
  • client_secret
  • redirect_uri

  function OAuth2(client_id, client_secret, redirect_uri, options){
    //...
  }
  OAuth2.prototype.getAuthenticateURL = function(option_arg){ 
    //...
  }
  OAuth2.prototype.getAccessData = function(code){ 
    //... 
  }
  OAuth2.prototype.refreshAccessToken = function(refresh_token){
    //...
  }

  exports.OAuth2 = OAuth2;

https://github.com/lyle/wakanda-googleOAuth2-client

Wakanda

Wakanda Application Framework

Wakanda Studio

wakandaDB

wakandaDB

Database

Object-Relational

JavaScript Objects

Indexed

Transactional

Web Server

RESTful Interface

JavaScript SS

Multi-Threaded

Services with CommonJS

wakandaDB scheama

  {"dataClasses": [
    { "name": "Chicken",
      "className": "Chicken",
      "collectionName": "Chickens",
      "scope": "public",
      "attributes": [
        { "name": "ID",
          "kind": "storage",
          "scope": "public",
          "unique": true,
          "autosequence": true,
          "type": "long",
          "primKey": true
        },
        { "name": "name",
          "kind": "storage",
          "scope": "public",
          "type": "string"
        },
        { "name": "hatchDate",
          "kind": "storage",
          "scope": "public",
          "type": "date",
          "simpleDate": false
          }
        }
      ]
    }
  ]}


  GoogleAccess = new DataClass("GoogleAccessCollection" ,"public");
  GoogleAccess.ID = new Attribute("storage", "long", "key");

  GoogleAccess.access_token = new Attribute("storage", "string");
  GoogleAccess.token_type = new Attribute("storage", "string");
  GoogleAccess.refresh_token = new Attribute("storage", "string");


  var entityMethods;
  entityMethods = exports;

  var googleOAuth2 = require('GoogleOAuth2/GoogleOAuth2').OAuth2;
  var glassApiData = require('ApiAppData').glassUser;

  var OAuth2Glass = new googleOAuth2(glassApiData.client_id,
    glassApiData.client_secret,
    glassApiData.redirect_uri,
    {scope:glassApiData.scope,
      approval_prompt:glassApiData.approval_prompt,
      access_type:"offline",
      state: 'glass'
    });
    


  entityMethods.getRefreshedAccessToken = function (){
    var newTokenSet;
    if (this.refresh_token) {
      newTokenSet = OAuth2Glass.refreshAccessToken(this.refresh_token);
      if (newTokenSet && newTokenSet.error){
        return false;
      }
      if (newTokenSet && newTokenSet.access_token){
        this.access_token = newTokenSet.access_token;
        this.save();
        return this.access_token;
      }
    }else{
      return false;
    }
    
  }; 

glass.wakanda.org