SlideShare a Scribd company logo
AmplifyJS
Visnupriya. J. R

© Spritle Software Private Limited | http://www.spritle.com
Overview
• AmplifyJS is a set of components designed to
solve common web application problems
using simple API.

• A JavaScript Component Library.
• Produced by appendTo().

© Spritle Software Private Limited | http://www.spritle.com
Features
• Ajax Request Management
• Client Side Component Communication
• Client Side Browser & Mobile Device Storage

© Spritle Software Private Limited | http://www.spritle.com
Request API
• It is an abstraction layer.
• It sets out to separate the data retrieval and
caching mechanisms from data requestors.

© Spritle Software Private Limited | http://www.spritle.com
Request Usage
Define a resource:
amplify.request.define( resourceId, requestType , settings )
amplify.request.define( resourceId, function resource ) // Define a custom
resquest

Request a resource:
amplify.request( resourceId, data, callback)

Spritle Software Private Limited | http://www.spritle.com
Request Types
• Built-in Types
• Ajax type

• Custom Types
• By adding “amplify.request.types” hashes
• an option to define custom one-off types for single
requests

© Spritle Software Private Limited | http://www.spritle.com
Request Example
amplify.request.define( “ResourceID", "ajax", {
url: “path/to/url/{type}",
dataType: "json“,
type: “GET”
});
amplify.request( "ResourceID ", { type : “test” },function(data){
// do some thing here
});

Spritle Software Private Limited | http://www.spritle.com
Request Data Handling
• Pre-defined Data.
• Provide data in the definition
• Data provided with the request will override data
provided in the definition

• URL substitution/routing.
• define variables in the URL of an ajax request by
wrapping the variable in curly braces, e.g., "/user/{id}"

• Decoders.
• Built-in Decoders
• Custom Decoders - amplify.request.decoders
© Spritle Software Private Limited | http://www.spritle.com
Request Example
amplify.request.decoders.sample = function ( data, status, xhr, success,
error ) {
if ( data.status === "success" ) {
success( data.data );
} else if ( data.status === "fail" || data.status === "error" ) {
error( data.message, data.status );
} else {
error( data.message , "fatal" );
}
};
amplify.request.define( “ResourceID", "ajax", {
url: “path/to/url/{id}",
dataType: "json“,
decoder: “sample”,
});
Spritle Software Private Limited | http://www.spritle.com
Request Caching
• In-memory Cache.
• cache: boolean
• cache: number

• Named Caches.
• cache: string

• Persistent Client-side Cache
• cache: "persist“ // default storage
• cache: "localStorage“ // specified storage

• Custom Caches
• amplify.request.cache

© Spritle Software Private Limited | http://www.spritle.com
Store API
• Persistent client-side storage systems.
• Supports IE 5+, Firefox 2+, Safari 4+, Chrome,
Opera 10.5+, iPhone 2+, Android 2+ .
• Provide a consistent API to handle storage
cross-browser.
• Handle serializing to and from a JavaScript
object using JSON serialization

© Spritle Software Private Limited | http://www.spritle.com
Store API Usage
Store a value:
amplify.store( key, value , options )

Get a value:
amplify.store( key)
amplify.store( ) // all values

Spritle Software Private Limited | http://www.spritle.com
Store API Usage
Store data explicitly with session storage:
amplify.store.StorageType( key,value)
Eg:
amplify.store.sessionStorage( "explicitExample" ,{ foo: “bar”});

Expiration:
amplify.store( key, value, {expires : 3000})

Spritle Software Private Limited | http://www.spritle.com
Pub/Sub API

• Facilitate the Publish and Subscribe messaging
pattern in your front-end application.
• The idea is that someone is broadcasting one
or more messages (publishing) and someone
else is listening to one or more messages
(subscribing).
• a slightly cleaner interface.
• prevents collisions between custom events
and method names.
• allows a priority.
© Spritle Software Private Limited | http://www.spritle.com
Subscribe API Usage
Subscribe to a message
amplify.subscribe( topic, function callback )
amplify.subscribe( topic, context, function callback )

amplify.subscribe( topic, function callback, priority )
amplify.subscribe( topic, context, function callback, priority )

Spritle Software Private Limited | http://www.spritle.com
Subscribe API Usage
Remove a subscription
amplify.unsubscribe( topic, function callback )

Spritle Software Private Limited | http://www.spritle.com
Publish API Usage
Publish a message
amplify.publish( topic )
amplify.publish( topic , arg1, arg2)

returns a Boolean indicating whether any
subscriptions returned false
Spritle Software Private Limited | http://www.spritle.com
Code Walk-through with Samples

© Spritle Software Private Limited | http://www.spritle.com
Questions?
Thank you

© Spritle Software Private Limited | http://www.spritle.com

More Related Content

PPTX
Introduction to Node.js by Vinothini B
PPTX
Cross platform mobile apps using rhomobile and jquery mobile
PDF
Introduction to Rhodes - By Surendran - Spritle software
PPTX
Draper - Visnupriya - spriteXchange
PPTX
Arduino for developers by Steve Robinson
PPTX
Intro to Raspberry Pi - by Sivakumar V
PPTX
[Cordova] Empezando con Ionic
PPT
Ionic Framework
Introduction to Node.js by Vinothini B
Cross platform mobile apps using rhomobile and jquery mobile
Introduction to Rhodes - By Surendran - Spritle software
Draper - Visnupriya - spriteXchange
Arduino for developers by Steve Robinson
Intro to Raspberry Pi - by Sivakumar V
[Cordova] Empezando con Ionic
Ionic Framework

What's hot (20)

PDF
Ionic 2 intro
PPTX
IONIC - Hybrid Mobile App Development
PPTX
DeveloperDeveloperDeveloper! Sydney 2012
PPTX
Introduction to the Ionic Framework
PPT
Vagrant&ansible
PPSX
Node on Windows Azure
PDF
JavaScript MV* Framework - Making the Right Choice
PDF
A Framework Driven Development
PDF
Hybrid Apps with Angular & Ionic Framework
PPTX
Prototyping Mobile Apps with NativeScript and Angular
PDF
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
PPTX
Getting Started with ASP.NET vNext
PPTX
Building mobile apps using meteorJS
PDF
Retour d’expérience sur Couchbase par James Nocentini
PPTX
Ionic Framework - get up and running to build hybrid mobile apps
PPTX
Mobile Applications with Angular 4 and Ionic 3
PPTX
Building iOS app using meteor
PPTX
Introduction to Ionic framework
PPTX
Mvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMO
KEY
iPhone Web Development
Ionic 2 intro
IONIC - Hybrid Mobile App Development
DeveloperDeveloperDeveloper! Sydney 2012
Introduction to the Ionic Framework
Vagrant&ansible
Node on Windows Azure
JavaScript MV* Framework - Making the Right Choice
A Framework Driven Development
Hybrid Apps with Angular & Ionic Framework
Prototyping Mobile Apps with NativeScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
Getting Started with ASP.NET vNext
Building mobile apps using meteorJS
Retour d’expérience sur Couchbase par James Nocentini
Ionic Framework - get up and running to build hybrid mobile apps
Mobile Applications with Angular 4 and Ionic 3
Building iOS app using meteor
Introduction to Ionic framework
Mvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMO
iPhone Web Development
Ad

Similar to Intro to Amplifyjs by Visnupriya (20)

KEY
Introducing Amplify
PDF
WebNet Conference 2012 - Designing complex applications using html5 and knock...
PPTX
WebNetConf 2012 - Single Page Apps
PDF
HTML5 JavaScript Interfaces
PDF
Client-side storage
PPT
single page application
PPT
Flex Framework Presentation PPT
PDF
Single Page Application (SPA): A Comprehensive Guide for Beginners
PDF
The Characteristics of a Successful SPA
PDF
WEB Mod5@AzDOCUMENTS.in.pdf
PDF
API Prefetching - HTML5DevConf - Oct. 21, 2014
PPT
Ajax Abuse Todcon2008
PDF
WEB MODULE 5.pdf
PDF
Ajax tutorial
PPTX
Single Page Applications: Your Browser is the OS!
PDF
Setup API Introductie
PPTX
Single page application and Framework
PPTX
Angular jS Introduction by Google
 
PDF
Kann JavaScript elegant sein?
PDF
PopSurvey Deck
Introducing Amplify
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNetConf 2012 - Single Page Apps
HTML5 JavaScript Interfaces
Client-side storage
single page application
Flex Framework Presentation PPT
Single Page Application (SPA): A Comprehensive Guide for Beginners
The Characteristics of a Successful SPA
WEB Mod5@AzDOCUMENTS.in.pdf
API Prefetching - HTML5DevConf - Oct. 21, 2014
Ajax Abuse Todcon2008
WEB MODULE 5.pdf
Ajax tutorial
Single Page Applications: Your Browser is the OS!
Setup API Introductie
Single page application and Framework
Angular jS Introduction by Google
 
Kann JavaScript elegant sein?
PopSurvey Deck
Ad

Recently uploaded (20)

PDF
Getting Started with Data Integration: FME Form 101
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Machine Learning_overview_presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
Teaching material agriculture food technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
A Presentation on Artificial Intelligence
PPTX
Spectroscopy.pptx food analysis technology
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
1. Introduction to Computer Programming.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
Getting Started with Data Integration: FME Form 101
The Rise and Fall of 3GPP – Time for a Sabbatical?
Machine Learning_overview_presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Teaching material agriculture food technology
Reach Out and Touch Someone: Haptics and Empathic Computing
Digital-Transformation-Roadmap-for-Companies.pptx
A Presentation on Artificial Intelligence
Spectroscopy.pptx food analysis technology
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
1. Introduction to Computer Programming.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Group 1 Presentation -Planning and Decision Making .pptx
Unlocking AI with Model Context Protocol (MCP)
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Weekly Chronicles - August'25-Week II

Intro to Amplifyjs by Visnupriya

  • 1. AmplifyJS Visnupriya. J. R © Spritle Software Private Limited | http://www.spritle.com
  • 2. Overview • AmplifyJS is a set of components designed to solve common web application problems using simple API. • A JavaScript Component Library. • Produced by appendTo(). © Spritle Software Private Limited | http://www.spritle.com
  • 3. Features • Ajax Request Management • Client Side Component Communication • Client Side Browser & Mobile Device Storage © Spritle Software Private Limited | http://www.spritle.com
  • 4. Request API • It is an abstraction layer. • It sets out to separate the data retrieval and caching mechanisms from data requestors. © Spritle Software Private Limited | http://www.spritle.com
  • 5. Request Usage Define a resource: amplify.request.define( resourceId, requestType , settings ) amplify.request.define( resourceId, function resource ) // Define a custom resquest Request a resource: amplify.request( resourceId, data, callback) Spritle Software Private Limited | http://www.spritle.com
  • 6. Request Types • Built-in Types • Ajax type • Custom Types • By adding “amplify.request.types” hashes • an option to define custom one-off types for single requests © Spritle Software Private Limited | http://www.spritle.com
  • 7. Request Example amplify.request.define( “ResourceID", "ajax", { url: “path/to/url/{type}", dataType: "json“, type: “GET” }); amplify.request( "ResourceID ", { type : “test” },function(data){ // do some thing here }); Spritle Software Private Limited | http://www.spritle.com
  • 8. Request Data Handling • Pre-defined Data. • Provide data in the definition • Data provided with the request will override data provided in the definition • URL substitution/routing. • define variables in the URL of an ajax request by wrapping the variable in curly braces, e.g., "/user/{id}" • Decoders. • Built-in Decoders • Custom Decoders - amplify.request.decoders © Spritle Software Private Limited | http://www.spritle.com
  • 9. Request Example amplify.request.decoders.sample = function ( data, status, xhr, success, error ) { if ( data.status === "success" ) { success( data.data ); } else if ( data.status === "fail" || data.status === "error" ) { error( data.message, data.status ); } else { error( data.message , "fatal" ); } }; amplify.request.define( “ResourceID", "ajax", { url: “path/to/url/{id}", dataType: "json“, decoder: “sample”, }); Spritle Software Private Limited | http://www.spritle.com
  • 10. Request Caching • In-memory Cache. • cache: boolean • cache: number • Named Caches. • cache: string • Persistent Client-side Cache • cache: "persist“ // default storage • cache: "localStorage“ // specified storage • Custom Caches • amplify.request.cache © Spritle Software Private Limited | http://www.spritle.com
  • 11. Store API • Persistent client-side storage systems. • Supports IE 5+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ . • Provide a consistent API to handle storage cross-browser. • Handle serializing to and from a JavaScript object using JSON serialization © Spritle Software Private Limited | http://www.spritle.com
  • 12. Store API Usage Store a value: amplify.store( key, value , options ) Get a value: amplify.store( key) amplify.store( ) // all values Spritle Software Private Limited | http://www.spritle.com
  • 13. Store API Usage Store data explicitly with session storage: amplify.store.StorageType( key,value) Eg: amplify.store.sessionStorage( "explicitExample" ,{ foo: “bar”}); Expiration: amplify.store( key, value, {expires : 3000}) Spritle Software Private Limited | http://www.spritle.com
  • 14. Pub/Sub API • Facilitate the Publish and Subscribe messaging pattern in your front-end application. • The idea is that someone is broadcasting one or more messages (publishing) and someone else is listening to one or more messages (subscribing). • a slightly cleaner interface. • prevents collisions between custom events and method names. • allows a priority. © Spritle Software Private Limited | http://www.spritle.com
  • 15. Subscribe API Usage Subscribe to a message amplify.subscribe( topic, function callback ) amplify.subscribe( topic, context, function callback ) amplify.subscribe( topic, function callback, priority ) amplify.subscribe( topic, context, function callback, priority ) Spritle Software Private Limited | http://www.spritle.com
  • 16. Subscribe API Usage Remove a subscription amplify.unsubscribe( topic, function callback ) Spritle Software Private Limited | http://www.spritle.com
  • 17. Publish API Usage Publish a message amplify.publish( topic ) amplify.publish( topic , arg1, arg2) returns a Boolean indicating whether any subscriptions returned false Spritle Software Private Limited | http://www.spritle.com
  • 18. Code Walk-through with Samples © Spritle Software Private Limited | http://www.spritle.com
  • 19. Questions? Thank you © Spritle Software Private Limited | http://www.spritle.com