Trying to replicate the performance and stability of native apps by just using HTML, CSS, and JavaScript, is an almost insurmountable task.
- Performance - StabilityOpen Quicktime with Phone Plugged In
AppGyver offers a web-based wizard to help you install Steroids.
http://academy.appgyver.com/installwizard
Once you have the prerequisites installed, type this into your terminal window:
$ npm install steroids -g
To check that everything is working correctly, type the following into your terminal:
$ steroids loginTheir wizard helps you install the prereqs - Git - Python - XCode + Command-line tools - Node / NVM / NPM
Steroids comes packed with some nifty command-line tools that make app development a breeze.
To create your base Steroids app, type the following into your terminal window:
$ steroids create projectName
This creates a new folder called projectName with your base app inside.
Demo in terminalIn your project's folder, type:
$ steroids connect
The Steroids server will start running and a browser window will open a page displaying a QR code that allows you to test your app on iOS and Android using the Scanner app!
Type the following into a terminal window in your project's root:
$ steroids deploy
A new QR code will open in your browser. Your app is now hosted on Steroids' Cloud Platform and anyone with the AppGyver Scanner app can scan the QR code to test the app on their device.
- Demo in terminal - Can configure and download builds for the App Store and Google Play using AppGyver's cloud platform- Build your app however you want - Using the tools you're already comfortable with - jQuery - Angular - ionic (included already) - Bootstrap - Ratchet (Purely Mobile Bootstrap)
your_project/ └── app/ ├── controllers/ | └── photo_gallery.js ├── models/ | └── photo_gallery.js └── views/ ├── photo_gallery/ | ├── index.html | ├── single.html | └── feed.html └── layouts/ └── photo_gallery.html
Install cool packages using Bower if you'd like. I'm installing jQuery!
$ bower install jquery --saveBower is already set up for your project, you can use it to manage whatever front end packages you'd like.
The www folder is where all of your app's assets live.
When Steroids builds your app, it copies everything from www over to dist, as well as the compiled contents of your app folder.
Let's change...
steroids.config.location = "http://localhost/index.html"
to...
steroids.config.location = "http://localhost/views/photo_gallery/index.html"
Don't actually put a line break in the location string. This is for the slides, dude.
- Changing this to use the MVC structure we set upIn your current view's controller file app/controllers/photo_gallery.js
// Display the native navigation bar with // the title "Photo Gallery" steroids.view.navigationBar.show("Photo Gallery");
Set in config/application.coffee
steroids.config.tabBar.enabled = true steroids.config.tabBar.tabs = [ { title: "Gallery" icon: "icons/photos@2x.png" location: "http://localhost/views/photo_gallery/index.html" }, { title: "Feed" icon: "icons/feed@2x.png" location: "http://localhost/views/photo_gallery/feed.html" } ]
In app/controllers/photo_gallery.js
$('#thumbnails img').on('click',function(){ var webView = new steroids.views.WebView( '/views/photo_gallery/single.html' ); steroids.layers.push(webView); });
In app/controllers/photo_gallery.js
var singleView = new steroids.views.WebView({ location: "/views/photo_gallery/single.html", id: "singleView" }); singleView.preload();This is so the WebView exists for the data we're about to pass it.
In app/controllers/photo_gallery.js
$('#thumbnails img').on('click',function(){ message = { recipient: 'singleView', src: $(this).attr('src'), title: $(this).attr('alt') } window.postMessage(message); steroids.layers.push(singleView); });- Uses the HTML5 postmessage API. - send the message in one webview - listening for that message in our target webview
In app/views/photo_gallery/single.html
function messageReceived(event) { // check that the message is intended for us if (event.data.recipient == "singleView") { $('#single .card').html( '<img src="' + event.data.src + '"><h3>' + event.data.title + '</h3>' ); } } window.addEventListener("message", messageReceived);
function getAcceleration() { navigator.accelerometer.getCurrentAcceleration( accelerometerOnSuccess, accelerometerOnError) } function accelerometerOnSuccess(acceleration) { acceleration_data.innerHTML = "x: " + acceleration.x + "<br>" + "y: " + acceleration.y + "<br>" + "z: " + acceleration.z + "<br>" + "timestamp: " + acceleration.timestamp } function accelerometerOnError(error) { alert("Accelerometer error: " + JSON.stringify(error)); }- Access cordova apis - Accelerometer, Camera, Contacts, Geolocation and more - All documented on Steroids' site
function getPicture() { navigator.camera.getPicture(onSuccess, onFail, { quality : 50, destinationType : Camera.DestinationType.DATA_URL }); } function onSuccess(imageData) { var image = document.getElementById('myImage'); image.src = "data:image/jpeg;base64," + imageData; } function onFail(message) { alert('Failed because: ' + message); }
http://docs.appgyver.com/en/stable/cordova_camera_camera.md.html
Basically just functions with a success and error callbackType simulator in to the Steroids terminal window while steroids connect is running, and the iOS Simulator will open.
You can then open up Safari and inspect your app's WebViews using Safari's Developer Tools!
https://x.appgyver.com/categories/2-tooling/contents/60-debugging-with-the-safari-web-inspector
steroids deploy
+
At the AppGyver Cloud Services page, you can configure builds for iOS and Android, ad-hoc and production.