Top Banner
Технологии для создания мобильных web приложений Константин Жандов
29

Konstantin Zhandov Presentation

Nov 11, 2014

Download

Documents

rit2010

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Konstantin Zhandov Presentation

Технологии для создания мобильных web приложений

Константин Жандов

Page 2: Konstantin Zhandov Presentation

Устройства с web-kit браузерами

Page 3: Konstantin Zhandov Presentation

iPhone like UI

Page 4: Konstantin Zhandov Presentation

Layout приложения

Page 5: Konstantin Zhandov Presentation

Один HTML файл

Page 6: Konstantin Zhandov Presentation

Загрузка контента1. Все данные сразу2. AJAX3. Часть данных сразу + AJAX

Page 7: Konstantin Zhandov Presentation

Загрузка контента1. Все данные сразу2. AJAX3. Часть данных сразу + AJAX

Page 8: Konstantin Zhandov Presentation

Загрузка контента1. Все данные сразу2. AJAX3. Часть данных сразу + AJAX

Page 9: Konstantin Zhandov Presentation

Загрузка контента1. Все данные сразу2. AJAX3. Часть данных сразу + AJAX

Page 10: Konstantin Zhandov Presentation

Кэшируем ресурсы1. CSS2. Javascript3. Images

Page 11: Konstantin Zhandov Presentation

Cache manifest#Cache v 1.0

CAHCE MANIFEST

index.html

stylesheet.css

scripts.js

image.png

Page 12: Konstantin Zhandov Presentation

Cache manifestCACHE:

stylesheet.css

NETWORK:

only_online.js

FALLBACK:images/ offline_image.png

Page 13: Konstantin Zhandov Presentation

Cache manifestCACHE:

stylesheet.css

NETWORK:

only_online.js

FALLBACK:images/ offline_image.png

Page 14: Konstantin Zhandov Presentation

Cache manifestCACHE:

stylesheet.css

NETWORK:

only_online.js

FALLBACK:images/ offline_image.png

Page 15: Konstantin Zhandov Presentation

Cache manifestCACHE:

stylesheet.css

NETWORK:

only_online.js

FALLBACK:images/ offline_image.png

Page 16: Konstantin Zhandov Presentation

Cache manifest#Cache v 1.0

CAHCE MANIFEST

index.html

stylesheet.css

scripts.js

image.png

Page 17: Konstantin Zhandov Presentation

Подключение manifest файла

<!DOCTYPE html>

<html manifest="cache.manifest">

# MIME type

text/cache-manifest manifest

Page 18: Konstantin Zhandov Presentation

Online или offline?

if (navigator.onLine == false)

{

// Блокируем бессмысленные действия

}

Page 19: Konstantin Zhandov Presentation

Локальное хранение данных

•Web Storage• Web SQL Database

Page 20: Konstantin Zhandov Presentation

Web Storage

• Session Storage• Local Storage

Page 21: Konstantin Zhandov Presentation

Web Storage API• setItem• getItem• removeItem• clear• length

Page 22: Konstantin Zhandov Presentation

Web Storage APIlocalStorage.setItem('username', 'SomeUser');

var username = localStorage.getItem('username');

localStorage.removeItem('username');

var storageCount = localStorage.length;

localStorage.clear();

Page 23: Konstantin Zhandov Presentation

Web SQL Database

• openDatabase• transaction• exequteSql

Page 24: Konstantin Zhandov Presentation

openDatabase

var db = openDatabase("someDb", "1.0", "Some local database", 5242880);

Page 25: Konstantin Zhandov Presentation

transaction

db.transaction(function(tx){    // Some sql})

Page 26: Konstantin Zhandov Presentation

exequteSql

db.transaction(function(tx){

tx.exequteSql(query, [parameters], function(tx, result){}, function(tx, error){})

})

Page 27: Konstantin Zhandov Presentation

Geolocation

Page 28: Konstantin Zhandov Presentation

Geolocation APIif (navigator.geolocation)navigator.geolocation.getCurrentPosition(showResult);

function showResult (position){    var latitude = position.coords.latitude;

var longitude = position.coords.longitude;}

Page 29: Konstantin Zhandov Presentation

Технологии для создания мобильных web приложений

Константин Жандов