Git Product home page Git Product logo

silver's Introduction

Silver(Fe) - A MVC Framework for Titanium SDK

An MVC framework that gives you a Facebook-alike app on both iOS and Android.

It doesn't have the model part, but you can easily add it as global objects. I will add the model part in the future.

This project consists of the framework's files, which are fe.js and /Resources/fe/base/*. It's very lightweighted.

The example project here shows you how to build navigate betweens pages (with animation), and how to build Facebook-alike menu.

It works on both iOS and Android. I hope you like it!

Version: 0.0.1

How to setup a controller

Your controller must be in /Resources/fe/controller, and the corresponding view must be in Resources/fe/views.

A controller and its corresponding view should have identical name.

For example:

/Resources/fe/controllers/News.js
/Resources/fe/views/News.js

Moreover, you need to add the controller's name into Fe.includeControllers(...). Life's not perfect.

In app.js, it should look like this:

Fe.includeControllers([
	'News',
	'Profile', 
	'SomePage', 
	'SomePageAgain',
	'Frame'
]);

At the main entry point, you also need to specify the first controller with:

Fe.setRootController(Fe.controllers.Frame);
Fe.openWindow();

And call Fe.openWindow() to open the window.

How to write a controller

please refer to the object __exports.

If you declare __exports.some_function, then the controller will have some_function method.

We also have a life-cycle for a controller, you can declare these methods:

__exports.viewLoaded = function() { ... };

__exports.viewWillAppear = function() { ... };
__exports.viewDidAppear = function() { ... };
__exports.viewWillDisappear = function() { ... };
__exports.viewDidDisappear = function() { ... };

The methods' names are self-explanatory.

How to switch between controllers

You can call Fe.pushController(Fe.controllers.SomePage) in order to switch to the SomePage controller.

Or you can call Fe.popController() in order to switch back to the previous controller.

Tips

  • Fe is a global variable
  • Fe.controllers is an object that contains the instances of controllers. For example, you can refer to the News controller using Fe.controllers.News

Advice

This is a very young framework. You need to study its source code in order to use it.

Just don't be lazy, ok?

Author

Tanin Na Nakorn -- in an attempt of helping ChatterBox build the first working prototype.

License

It's under Tanin's license, which means you can do whatever with it. For example:

  • No need to cite or mention that you are using this framework
  • You may copy and develop it into something else without referring to it
  • You may copy it and simply say it is yours

silver's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.