SlideShare ist ein Scribd-Unternehmen logo
1 von 19
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

Weitere ähnliche Inhalte

Was ist angesagt?

IONIC - Hybrid Mobile App Development
IONIC - Hybrid Mobile App DevelopmentIONIC - Hybrid Mobile App Development
IONIC - Hybrid Mobile App DevelopmentMalan Amarasinghe
 
DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012kittenthecat
 
Introduction to the Ionic Framework
Introduction to the Ionic FrameworkIntroduction to the Ionic Framework
Introduction to the Ionic Frameworkrrjohnson85
 
JavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceJavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceDmitry Sheiko
 
A Framework Driven Development
A Framework Driven DevelopmentA Framework Driven Development
A Framework Driven Development정민 안
 
Hybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic FrameworkHybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic FrameworkCihad Horuzoğlu
 
Prototyping Mobile Apps with NativeScript and Angular
Prototyping Mobile Apps with NativeScript and AngularPrototyping Mobile Apps with NativeScript and Angular
Prototyping Mobile Apps with NativeScript and AngularMike Branstein
 
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularNativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularTodd Anglin
 
Retour d’expérience sur Couchbase par James Nocentini
Retour d’expérience sur Couchbase par James NocentiniRetour d’expérience sur Couchbase par James Nocentini
Retour d’expérience sur Couchbase par James NocentiniCocoaHeads France
 
Ionic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsIonic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsAndreas Sahle
 
Mobile Applications with Angular 4 and Ionic 3
Mobile Applications with Angular 4 and Ionic 3Mobile Applications with Angular 4 and Ionic 3
Mobile Applications with Angular 4 and Ionic 3Oleksandr Tryshchenko
 
Introduction to Ionic framework
Introduction to Ionic frameworkIntroduction to Ionic framework
Introduction to Ionic frameworkShyjal Raazi
 
Mvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMO
Mvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMOMvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMO
Mvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMOKumton Suttiraksiri
 

Was ist angesagt? (20)

Ionic Framework
Ionic FrameworkIonic Framework
Ionic Framework
 
Ionic 2 intro
Ionic 2   introIonic 2   intro
Ionic 2 intro
 
IONIC - Hybrid Mobile App Development
IONIC - Hybrid Mobile App DevelopmentIONIC - Hybrid Mobile App Development
IONIC - Hybrid Mobile App Development
 
DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012
 
Introduction to the Ionic Framework
Introduction to the Ionic FrameworkIntroduction to the Ionic Framework
Introduction to the Ionic Framework
 
Vagrant&ansible
Vagrant&ansibleVagrant&ansible
Vagrant&ansible
 
Node on Windows Azure
Node on Windows AzureNode on Windows Azure
Node on Windows Azure
 
JavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceJavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right Choice
 
A Framework Driven Development
A Framework Driven DevelopmentA Framework Driven Development
A Framework Driven Development
 
Hybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic FrameworkHybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic Framework
 
Prototyping Mobile Apps with NativeScript and Angular
Prototyping Mobile Apps with NativeScript and AngularPrototyping Mobile Apps with NativeScript and Angular
Prototyping Mobile Apps with NativeScript and Angular
 
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularNativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
 
Getting Started with ASP.NET vNext
Getting Started with ASP.NET vNextGetting Started with ASP.NET vNext
Getting Started with ASP.NET vNext
 
Building mobile apps using meteorJS
Building mobile apps using meteorJSBuilding mobile apps using meteorJS
Building mobile apps using meteorJS
 
Retour d’expérience sur Couchbase par James Nocentini
Retour d’expérience sur Couchbase par James NocentiniRetour d’expérience sur Couchbase par James Nocentini
Retour d’expérience sur Couchbase par James Nocentini
 
Ionic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsIonic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile apps
 
Mobile Applications with Angular 4 and Ionic 3
Mobile Applications with Angular 4 and Ionic 3Mobile Applications with Angular 4 and Ionic 3
Mobile Applications with Angular 4 and Ionic 3
 
Building iOS app using meteor
Building iOS app using meteorBuilding iOS app using meteor
Building iOS app using meteor
 
Introduction to Ionic framework
Introduction to Ionic frameworkIntroduction to Ionic framework
Introduction to Ionic framework
 
Mvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMO
Mvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMOMvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMO
Mvpskill Saturday EP_17 26 October 2562 - Azure Products Update + DEMO
 

Ähnlich wie Intro to Amplifyjs by Visnupriya

API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsApigee | Google Cloud
 
HTML5 Programming
HTML5 ProgrammingHTML5 Programming
HTML5 Programminghotrannam
 
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)Amazon Web Services
 
Legacy java ee meet lambda
Legacy java ee  meet lambdaLegacy java ee  meet lambda
Legacy java ee meet lambdaKim Kao
 
Coherence Overview - OFM Canberra July 2014
Coherence Overview - OFM Canberra July 2014Coherence Overview - OFM Canberra July 2014
Coherence Overview - OFM Canberra July 2014Joelith
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM iZend by Rogue Wave Software
 
Servlet., tomcat server, implicit jsp object
Servlet., tomcat server, implicit jsp objectServlet., tomcat server, implicit jsp object
Servlet., tomcat server, implicit jsp objectADITYADIXIT974283
 
Building Serverless Real-time Data Processing (Now with Unicorns!)
Building Serverless Real-time Data Processing (Now with Unicorns!)Building Serverless Real-time Data Processing (Now with Unicorns!)
Building Serverless Real-time Data Processing (Now with Unicorns!)Amazon Web Services
 
Build a Node.js Client for Your REST+JSON API
Build a Node.js Client for Your REST+JSON APIBuild a Node.js Client for Your REST+JSON API
Build a Node.js Client for Your REST+JSON APIStormpath
 
Build A Killer Client For Your REST+JSON API
Build A Killer Client For Your REST+JSON APIBuild A Killer Client For Your REST+JSON API
Build A Killer Client For Your REST+JSON APIStormpath
 
The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010Phil Pursglove
 
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010IrishDev.com
 
Workshop Building Serverless Real-time Data Processing (Now with Unicorns!) -...
Workshop Building Serverless Real-time Data Processing (Now with Unicorns!) -...Workshop Building Serverless Real-time Data Processing (Now with Unicorns!) -...
Workshop Building Serverless Real-time Data Processing (Now with Unicorns!) -...Amazon Web Services
 
Persistent Storage with Kubernetes in Production
Persistent Storage with Kubernetes in ProductionPersistent Storage with Kubernetes in Production
Persistent Storage with Kubernetes in ProductionCheryl Hung
 
WebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsWebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsPavel Bucek
 
Oracle Cloud Storage Service & Oracle Database Backup Cloud Service
Oracle Cloud Storage Service & Oracle Database Backup Cloud ServiceOracle Cloud Storage Service & Oracle Database Backup Cloud Service
Oracle Cloud Storage Service & Oracle Database Backup Cloud ServiceJean-Philippe PINTE
 
Building High Performance and Scalable Applications Using AppFabric Cache- Im...
Building High Performance and Scalable Applications Using AppFabric Cache- Im...Building High Performance and Scalable Applications Using AppFabric Cache- Im...
Building High Performance and Scalable Applications Using AppFabric Cache- Im...Impetus Technologies
 
In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and meJason Casden
 
AWS Serverless Interface Building and Cerner's FHIR Experience (HLC401) - AWS...
AWS Serverless Interface Building and Cerner's FHIR Experience (HLC401) - AWS...AWS Serverless Interface Building and Cerner's FHIR Experience (HLC401) - AWS...
AWS Serverless Interface Building and Cerner's FHIR Experience (HLC401) - AWS...Amazon Web Services
 

Ähnlich wie Intro to Amplifyjs by Visnupriya (20)

API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIs
 
HTML5 Programming
HTML5 ProgrammingHTML5 Programming
HTML5 Programming
 
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
 
Legacy java ee meet lambda
Legacy java ee  meet lambdaLegacy java ee  meet lambda
Legacy java ee meet lambda
 
Coherence Overview - OFM Canberra July 2014
Coherence Overview - OFM Canberra July 2014Coherence Overview - OFM Canberra July 2014
Coherence Overview - OFM Canberra July 2014
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 
Servlet., tomcat server, implicit jsp object
Servlet., tomcat server, implicit jsp objectServlet., tomcat server, implicit jsp object
Servlet., tomcat server, implicit jsp object
 
Building Serverless Real-time Data Processing (Now with Unicorns!)
Building Serverless Real-time Data Processing (Now with Unicorns!)Building Serverless Real-time Data Processing (Now with Unicorns!)
Building Serverless Real-time Data Processing (Now with Unicorns!)
 
Build a Node.js Client for Your REST+JSON API
Build a Node.js Client for Your REST+JSON APIBuild a Node.js Client for Your REST+JSON API
Build a Node.js Client for Your REST+JSON API
 
Build A Killer Client For Your REST+JSON API
Build A Killer Client For Your REST+JSON APIBuild A Killer Client For Your REST+JSON API
Build A Killer Client For Your REST+JSON API
 
The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010
 
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
 
Workshop Building Serverless Real-time Data Processing (Now with Unicorns!) -...
Workshop Building Serverless Real-time Data Processing (Now with Unicorns!) -...Workshop Building Serverless Real-time Data Processing (Now with Unicorns!) -...
Workshop Building Serverless Real-time Data Processing (Now with Unicorns!) -...
 
uMobile Development Strategies
uMobile Development StrategiesuMobile Development Strategies
uMobile Development Strategies
 
Persistent Storage with Kubernetes in Production
Persistent Storage with Kubernetes in ProductionPersistent Storage with Kubernetes in Production
Persistent Storage with Kubernetes in Production
 
WebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsWebSockets in Enterprise Applications
WebSockets in Enterprise Applications
 
Oracle Cloud Storage Service & Oracle Database Backup Cloud Service
Oracle Cloud Storage Service & Oracle Database Backup Cloud ServiceOracle Cloud Storage Service & Oracle Database Backup Cloud Service
Oracle Cloud Storage Service & Oracle Database Backup Cloud Service
 
Building High Performance and Scalable Applications Using AppFabric Cache- Im...
Building High Performance and Scalable Applications Using AppFabric Cache- Im...Building High Performance and Scalable Applications Using AppFabric Cache- Im...
Building High Performance and Scalable Applications Using AppFabric Cache- Im...
 
In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and me
 
AWS Serverless Interface Building and Cerner's FHIR Experience (HLC401) - AWS...
AWS Serverless Interface Building and Cerner's FHIR Experience (HLC401) - AWS...AWS Serverless Interface Building and Cerner's FHIR Experience (HLC401) - AWS...
AWS Serverless Interface Building and Cerner's FHIR Experience (HLC401) - AWS...
 

Kürzlich hochgeladen

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 

Kürzlich hochgeladen (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

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