Created
April 29, 2011 23:11
-
-
Save vindriaoc/949196 to your computer and use it in GitHub Desktop.
Kopi NameSpaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Ki={}; //Root of Kopi.TIME NameSpaces | |
var Kopi=Ki; //Root of Kopi.TIME NameSpaces | |
Kopi.app='App' //"Curr App", Application w/ share implementation (Ex: Kopi.Viewer) | |
Kopi.<App>={}; //"Some App" (Change <App> with your app name see Ex: Auth) | |
Kopi.<App>.f={}; //"Some App" must declare function in this namespaces! | |
Kopi.<App>.<Ns>={}; //"Some App" have NameSpace or copy of instance object | |
Kopi.Tab={}; //Tab Module | |
Kopi.Tab.Group. //Instance of tabGroup use in this application | |
Kopi.Tab.Items={}; //NameSpace Instance of Tab | |
Kopi.Tab.Items.<Tb>={}; //Instance of Tab (auto create after run Kopi.Tab.f.init()) | |
Kopi.Tab.f.app() //Get active tab and return current App | |
Kopi.Tab.f.init() //Create Tab & Tab Group and Show it | |
Kopi.Tab.f.init.<funcs> //NameSpaces of functions, autorun when Kopi.Tab.f.init() called | |
//Ex: It will create working Application with 2 tab | |
Kopi.Tab.f.init(['Home','Setting']); | |
Kopi.Auth={}; //Authentication Module | |
Kopi.Auth.Indicator. //Instance of ActivityIndicator use in Authentication Module | |
Kopi.Auth.f.getApi() //Get Services from API | |
Kopi.Auth.f.getToken() //Get Token, its need params of username & password | |
Kopi.Auth.f.saveToken() //Save token | |
Kopi.Auth.f.loadToken() //Load token | |
//Ex: Login - Button Action | |
btn.addEventListener('click', function(e){ | |
Kopi.Auth.f.initLogin('username','password'); | |
Kopi.Auth.f.getToken('POST','http://10.0.2.2:3000/oauth/xaccess_token', | |
function($$) | |
{ | |
//alert('token:'+Kopi.Auth.b.tk+' - token secret:'+Kopi.Auth.b.tks); | |
Kopi.Auth.f.saveToken(); | |
//others action... | |
Kopi.Auth.f.getApi('GET',url,function() | |
{ | |
Kopi.Home.f.ui(); | |
Kopi.Home.f.initMenu(); | |
}); | |
}); | |
}); | |
//Ex: Load - Button Action | |
btn.addEventListener('click', function(e){ | |
Kopi.Auth.f.getApi('GET',app.f.urlIndex(),function() | |
{ | |
app.tv.setData(Kopi.Viewer.f.tvData()); | |
}); | |
}); | |
Kopi.Viewer={}; //Viewer/tableView Module | |
Kopi.Viewer.f.tvRows() //construct tableView Row | |
Kopi.Viewer.f.tvData() //Prepare to construct tableView Row | |
Kopi.Viewer.f.tvScrollEventListener() //Scroll Listener for tableView | |
Kopi.Viewer.f.tvScrollEvent() //Scroll AddListener | |
Kopi.Viewer.f.winOpenEventListener() //Open Listener for window | |
Kopi.Viewer.f.winOpenEvent() //Open addListener | |
Kopi.Viewer.f.reload() //Reload tableView | |
Kopi.Stream=function(){}; //Closures for Stream | |
Kopi.Stream.Last={}; //Instance of last-stream | |
Kopi.Stream.ready=false; //First call to this stream? | |
Kopi.Stream.Paginate={}; //Namespace for paginate-related | |
Kopi.Stream.f.urlIndexStream() //Generate index-stream url | |
Kopi.Stream.f.urlNextStream() //Generate next-stream url | |
Kopi.Stream.f.urlAvatar() //Generate avatar-stream url | |
Kopi.tv. //Instance of TableView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment