Android: https://github.com/bradedelman/baller-android
iOS: https://github.com/bradedelman/baller-ios
Web: https://github.com/bradedelman/baller-web
Now that you've seen the sample running on Android, iOS and Web, let's take a look at the sample View itself and learn how we can edit, transpile and run.
-
Install the TypeScript Transpiler
First, you need to be sure you have "node"... If not, you can install with HomeBrew
brew install node node --version // to confirm it's there
Once you have node, you can use node to install TypeScript:
npm install -g typescript tsc --version // to confirm it's there
-
Find out your local IP address, so you can point clients at a local server.
Lot's of ways to find out... if you're on WIFI, you can use a little script included in the repo:
bradedelman@Brad baller-core % bash show_wifi_IP.bash 10.0.0.97
In the examples below, where you see YOUR_IP, use your IP.
-
Start the Local Transpile Server
To make it easy to iterate, we use a simple local Python server that knows how to run the TypeScript compiler and serve the results.
cd baller-core (wherever you cloned it) python3 server.py (python3 should already be installed on OSX) when it starts, it will print to the console Starting Baller Transpile Server on Port 3000...
-
Let's modify 1 or more sample apps to use the locally served script. Basically, we just need to update the URL for where to get the script (note the change from https to http as well):
Android in MainActivity, change: ballerView.loadUrl("https://www.cleverfocus.com/baller/sample.js") to ballerView.loadUrl("http://YOUR_IP:3000/sample.js")
iOS in ViewController, change: ballerView.loadUrl(urlString: "https://www.cleverfocus.com/baller/sample.js") to ballerView.loadUrl(urlString: "http://YOUR_IP:3000/sample.js")
Web in index.html, change: baseUrl: 'https://www.cleverfocus.com/baller/' to baseUrl: 'http://YOUR_IP:3000/' change
-
Now run and see that everything is the same as before (list of 1,000 items). Yay! Ok, now let's try some changes to the view.
-
Open the sample code. While technically, you could just edit sample.ts in any text editor, I recommend opening the baller-core directory as a Project in IntelliJ. IntelliJ understand TypeScript and will provide syntax checking, coloring, code validation, etc.
Once it is open, you can select the sample.ts file and you should see this:
-
Let's make a simple change. Change "Hello Baller" to "Hello World"
-
Ok, refresh index.html (or re-run your iOS/Android app) - it's changed!
Obviously, hitting refresh in the brower is fastest/easiest. In fact, the reason the Web Platform is supported for this Framework which is meant for Android/iOS is for development velocity and quick iterations.