際際滷

際際滷Share a Scribd company logo
則
Making High
Performance
PhoneGap Apps
How we made people think that
Snowbuddy was a native app
則
則
ABOUT US
則
We 3 js
Calvin Harris
18 Months App
Top 5 iOS Music App on the App Store
26% CTR to buy the album, pre-orders helped the album
debut at #1 in the Dance charts
Featured by both Apple & Google and coined a piece of
art from a Digital Rights Management point of view
We decided to give Calvins album
away for free, but with a twist.
You had to be dancing to listen to
the music.
mobile OF THE DAY
Finalist
則
NOW Whats 
That Song
Over 1 Million games played after less than 2 weeks
Over 300,000 users after less than 3 weeks
#2 iOS App across all apps (iPhone & iPad)
Featured by Facebook & Parse
An iPhone & iPad song 
quiz game for NOW 
Thats What I Call Music
則
Standing 
Novation
Exhibited at The Tate Modern, June 2014
Exhibited in The Barbican, August 2013
Hack the Barbican South Place Hotel Award Winner
An interactive physical digital 
art installation. A serene moment 
in a vibrant digital space.
則
UEFA Champions 
League
Custom made screens built around 
a giant statue in the centre of Lisbon
displaying content from fans from all
over the world and visualizing team
support, lineups and game information.
則
Social content and data
visualizations for the UEFA
Champions League Final.
則
Samsung
Shoreditch
Studio
An awesome digital representation of a classic record store
Combining music and tech in the simplest possible 敬温霞
NFC triggered digital turntable.
Walk in, tap a record sleeve, 
play a song simple.
則
snowbuddy
40,000+ users
Best new app
Best apps
of 2014
則
則
Did you use swift or
objective-c?
則
What we used
則
Its Easy to
write bad javascript
則
7 tips for high
performance
phonegap apps
01 Use a JS Framework
02 Avoid Janky Animations
03 The Dreaded Tap Delay
04 Offline Syncing
05 Background Tasks
06 Avoid Memory Leaks
07 Use CrossWalk
則
Disclaimer
The one true 敬温霞
則
Use a JS Framework
01
則
dont reinvent
the wheel
則
A problem shared
is a problem solved
則
avoid Janky
animations
02
則
Use css transitions
則
.el {
top:0;
transition:200ms top;
}
.el.animated {
top:20px;
}
則
.el {
top:0;
transition:200ms top;
}
.el.animated {
top:20px;
}
則
.el {
top:0;
transition:200ms transform;
}
.el.animated {
transform:translate3d(0, 20px, 0);
}
則
The Dreaded
tap delay
03
則
300ms delay is *
ontap
ontouchstart
ontouchend
onclick
則
則
FastClick.attach(document.body);
github.com/ftlabs/fastclick
Fastclick
則
offline storage
04
則
localstorage
has its issues
則
lets try the
local file system!
則
pouchdb
its awesome
pouchdb.com
var db = new PouchDB(
'myDB',
{
adapter: 'websql'
}
);
則
pouchdb
db.put({
_id: 'wmas',
awesome: true
});
則
pouchdb
db.get('wmas').then(function (doc) {
// handle doc
}).catch(function (err) {
console.log(err);
});
則
pouchdb
則
background tasks
05
則
updating the UI
when the app is in
the background
則
updating the UI
when the app is in
the background
document.addEventListener(
'pause',
onPause,
false
);
document.addEventListener(
'resume',
onResume,
false
);
則
則
Avoid memory leaks
06
則
Code reuse
=
element reuse
則
fully Remove media
from memory
img.src = /slideshow/high-performance-phonegap-apps/48272462/&
video.src = '';
則
timeouts
and
intervals
則
timeouts
and
intervals
則
Test
Evaluate
Debug
則
safari dev tools ->
timelines
則
Chrome DEv tools ->
profiles
則
instruments ->
allocations
則
use crosswalk
07
則
則
crosswalk
its awesome
cordova plugin add
https://github.com/MobileChromeApps/cordova-plugin-crosswalk-webview.git
則
conclusion
則
Its Easy to
write bad javascript
則
Its fun to
write good javascript
則
THANKS
any questions?
@sydlawrence
sydlawrence@wemakeawesomesh.it

More Related Content

High Performance PhoneGap Apps