たぼさんの部屋

いちょぼとのんびり

javascript 基本構文

"use strict";
var efolabObj = {};
efolabObj.localStorageAdapter = function(key){
   this.KEY = key;
};
efolabObj.localStorageAdapter.prototype = {
  getKey:function(){
     return this.KEY;
  } 
};
(function(){
   var 
      ns = efolabObj , 
      adapter;
   function init(){
      adapter = new ns.localStorageAdapter("kamogashira");
      console.log(adapter.getKey());
   }
   if (document.body) {
      init();
   } else {
      document.addEventListener('DOMContentLoaded', init, false);
   }
}());