victorteokw / cocoabean Goto Github PK
View Code? Open in Web Editor NEWWrite a single code base in javaScript, and deploy everywhere.
License: MIT License
Write a single code base in javaScript, and deploy everywhere.
License: MIT License
For cocoa, android, window and web
Different platform has different local code,
but a lot of javaScript code are shared,
how to share code?
Generate a Xcode project, fill some objc file, and have it require CocoaBean.framework and app.js file
Currently, code documentation is few.
Need to add documentation to source code of web platform.
Documentation should be in codo format.
[DONE] Most commands need to be in app dir and requires existance of Beanfile, move the corresponding method and vars to CocoaBean::Command
[TODO] Fix Beanfile is not generated bug
[TODO] Use a optional template language style. -> If the template of the file to be generated has suffix .erb, then process it with erb, otherwise just copy it.
[TODO] There are several generator subclasses, refactor it to two: TemplateGenerator and BlockGenerator. Means: generate with template files / generate with a block of constructions with some dependencies.
Currently text view is not implemented.
Text view should be implemented.
View rendering is compatible with iOS native API.
CB.Renderer is responsible for DOM manipulation.
CB.View is the base view class. It has a property named 'layer', and layer is a jQuery DOM object.
CB.Window is a subclass of CB.View, and it represents $("body").
CB.Rect is analogous with CGRect.
CB.Point is analogous with CGPoint.
CB.Size is analogous with CGSize.
cocoabean new APP_PATH --lang=[coffee|es6]
DONE
cocoabean test [web | ios | osx]
to unit test DONE
cocoabean preview [web | ios | osx]
to preview DONE
cocoabean dist
to generate web page or app archive DONE
cocoabean open
to open project in user's favorite editor DONE
cocoabean about
to show information of a project Need improve
configurable through ~/.cocoabeanrc
CocoaBean::Preferences do end DONE
cocoabean add platform
to generate platform specific code TODO
cocoabean update
-> sync settings to platform projects e.g. app version
cocoabean check
to check setting sync status
On every platform, image should be supported.
However, there are differences between platforms. For web platform, images are fetched from web, for local platform, some are, some are not.
Local images are always part of UI, while web images are always related to content and are dynamic.
On local platform, images gets its width and height just on create, however there is no way to get image's intrinsic size before the image is fetched.
Also, on local platform, different size versions of an image are provided, made it easy to work for different displays.
By using ImageMetadata, on web platform, we can get the behavior of local image.
Get width and height just on create.
Support @2x, default, @3x even much more!
For web images, native platform should support asynchronous loading and resizing.
For web platform, thread may reference
http://stackoverflow.com/questions/5408406/web-workers-without-a-separate-javascript-file
Currently scroll view is not implemented.
Scroll view should be implemented.
The current layout and phrases of README.md is not ideal.
api was inspired here:
https://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CGGeometry/
class CB.Point
constructor: (x, y) ->
@_x = x
@_y = y
@property "readonly", "x"
@property "readonly", "y"
class CB.Rect
constructor: (x, y, width, height) ->
@_origin = new CB.Point(x, y)
@_size = new CB.Size(width, height)
@property "readonly", "origin"
@property "readonly", "size"
This is equivalent to UIButton,
but several subclasses may be added.
CB.TextButton which is similar to hyper link
CB.ImageButton, may show some text if image is not fully loaded
Device: iPhone or Android
Environment: Local or web
OS: iOS, OSX or Android
Use this command inside an app dir to unit test.
Currently, 'cocoabean open' open project in current dir.
Most of times, this is desired behavior.
It's better to add this option to open application's root directory.
Currently gesture dispatch code is not completed.
Complete the code.
Somehow like rails, show error on page.
These two classes should be used for image displaying
Shouldn't show scroll bar if view is overflow.
Since view is not scroll view.
Maybe use max-width calculation to fix?
add multiple nice method to extents the fundamental classes.
This command launches web browser or ios simulator to have user see the app and debug it.
instance variable | meaning | example |
---|---|---|
@author_name | the name of the creator | "John Appleseed" |
@created_at | the date the application is created | "1995-06-18" |
@module_name | the js module name | "MYFANCYAPP" |
@app_name | the app name used in code | "my_fancy_app" |
@app_readable_name | the app name which is read by human | "My Fancy App" |
How to dispatch gestures and clicks?
Does this work?
http://stackoverflow.com/questions/5931172/x-y-touch-coordinates-for-ios-mobile-devices
document.addEventListener('touchstart', function(e) {
}, false);
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, false);
Every class and feature should be tested by jasmine.
By running 'cocoabean dist' inside application directory, user get the newest generated app.js into target applications.
web environment js test is setup.
Unit test code should be deliberate.
When error happens, show message and exit.
When generating app.
When about app.
In a word, all command should have output colored and good-formatted.
The CB.Color class are easy to reuse on every platform.
Need add some manipulation methods.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.