SlideShare uma empresa Scribd logo
1 de 41
Welcome
Enhancing SharePoint
Experience using JavaScript
Pushkar Chivate
My Background
 Senior SharePoint and Web developer /
Application Architect
Agenda
- JavaScript:
- Why use JavaScript?
- Best Practices
- SharePoint app using some useful JavaScript
libraries
- Utility Libraries
- Data access Libraries
- Application Development Frameworks
- Libraries that Enhance User Interface
Why use JavaScript?
 Traditional SharePoint development
 On premises development
 Server side code
 App development
 In the cloud
 Client side code
JavaScript Best Practices
 Strict mode
 Equality operators
 Encapsulation
 Promises
Always use strict mode
 Declared with "use strict"
 Restrictions
 Cannot use a variable without declaring it
 Cannot write to a read-only property
 Cannot add properties to non-extensible objects
 Cannot illegally delete functions and variables
 Cannot define a property more than once in an object literal
 Cannot use a parameter name more than once in a function
 Cannot use reserved words, eval, or arguments, as names for functions and
variables
 The value of this in a function is no longer the window object
 Cannot declare functions inside of statements
 Cannot change the members of the arguments array
Always use ===
== Vs ===
!= Vs !==
JavaScript scopes
 Scope is at function level
 var is “private”
 this. is “public”
 No block level scope
Encapsulate your code
 Singleton pattern
 Module pattern
 Prototype pattern
Using the Singleton pattern
var department = {
name: "Sales",
getDepartmentInfo: function () {
alert("Department name is '" + this.name + "'");
}
};
department.getDepartmentInfo();
Using the Module pattern
var Organization = {};
Organization.Module = {};
Organization.Module.Department = function () {
//private members
var name,
setDepartmentInfo = function (n) { this.name = n; },
getDepartmentInfo = function () { alert(this.name); };
//public interface
return {
setDepartmentInfo: setDepartmentInfo,
getDepartmentInfo: getDepartmentInfo
}
}(); // self invoking function
// Advantages: Hides function members, Can use private and public members
Using the Prototype pattern
var Organization = {};
Organization.Department = function (n) {
this.name = n
};
Organization.Department.prototype = {
getDepartmentInfo: function () { alert(this.name); }
};
var department = new Organization.Department("Sales");
department.getDepartmentInfo();
// every object in JavaScript has prototype
// use of the keyword new
// useful for creating a lots of instances of one object
Promises
 Also called “Deferreds”
 Simplify asynchronous operations
jQuery Deferred
Demo
JavaScript Libraries
 Utility Libraries
 jQuery
 SPServices
 Data Libraries
 DataJS
 Application Framework Library
 AngularJS
 UI Library
 DataTables.js
 KendoUI
Deploying JavaScript Files
 Content Delivery Networks (CDNs)
 Use https
 Monkey-Patching
 Under Layouts folder
 Farm solutions
 Virtual File Systems
 Document Libraries
 Sandboxed solutions, Apps
Using the SharePoint RESTful endpoint
_api is alias for _vti_bin/client.svc
Custom Client Code
JavaScript
Library
Server
Client
.Net CLR
Overview of SharePoint & Office 365 JavaScript
Options
 Content Editor Web Part
 Script Editor Web Part
 SharePoint Designer
 <ScriptLink> or <Script>
 Server Side Code Injection
 RegisterClientScriptBlock vs RegisterStartupScript
 Web Parts/Delegate Controls/Application Pages
 CSS JavaScript Injection
Advantages of ScriptLink over
Script element
 Dependency loading
 Localized version of your library
 Control over when the file gets added
 Doesn’t load the file multiple times if it’s already
loaded once, this improves performance
 The ScriptLink element provides benefit only
when your library files reside in layouts folder, if
you are side loading the script files, you will not
get any real benefit with ScriptLink element
Angular.js
 Description
 Implements Model-View-Controller (MVC) for JavaScript
 Location
 http://angularjs.org/
 https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js
 NuGet
 Features
 Model-View-Controller
 Data Binding
 Routing
 Directives
 Factories
Angular Framework
Module
Routes
View Controller
Directives Factory
$scope
Modules
 A container for the components of the app
//module
var myapp = angular.module(“myApp", []);
<!-- html -->
<div data-ng-app = "MyApp">
Reference dependent modules
Directives
 Utilizes HTML5 custom data attributes
 Allows for the addition of custom attributes starting with
data-
 Angular uses directives for declarative programming
 Angular directives start with “ng-”
 data-ng-app, defines scope of the framework
 data-ng-controller, invokes a controller
 data-ng-click, handles click event
Directives
<!DOCTYPE html>
<html data-ng-app=“myApp”>
<head></head>
<body>
<input type="text" data-ng-model="displayName"/>
<div data-ng-click="update" ng-controller="myCtrl">
</div>
</body>
</html>
Initializes the app. Can be
anonymous or named.
Creates a property on the
ViewModel
References a controller
named “myCtrl”, which
creates a new ViewModel.
References a
controller method to
call on a click event
Simple Data Binding
<div ng-app=“myApp">
<div ng-controller="myCtrl">
<input type="text" data-ng-model="firstName"/>
<div>{{firstName}}</div>
</div>
</div>
• Binds ViewModels to HTML elements
• Uses {{…}} syntax
• References a property of a ViewModel
• Supports two-way binding
This example will display
whatever the user types
Controllers
//controller
myapp.controller(“myCtrl", ["$scope",
function welcomeCtrl($scope) {
//model
$scope.welcomeMessage = "Hi";
}
);
<!-- html -->
<div data-ng-controller=“myCtrl">
• Build up the $scope (a.k.a, View Model)
View Binding
<div ng-app=“myApp">
<div ng-controller=“myCtrl">
<h3>{{welcomeMessage}}</h3>
</div>
</div>
• Bind the $scope to the HTML elements
AngularJS
Demo
Angular-1 View Synchronization
•Declarative
•Separation between template and code
•Two-way data binding
•Stateful
•Nested Scopes (Controller As)
•Unidirectional flow
Angular-2 what’s coming
• Still declarative
• Separation between template and code
• 3 types of directives – components
(directives, controllers), decorators,
templates (transformative, e.g. ng-if)
• Support for unidirectional data flow
• Three models: stateful, reactive, immutable
• Controllers are folded into components
JavaScript Library: DataTables
 DataTables (http://www.datatables.net/)
JavaScript Libraries
 KendoUI (http://www.telerik.com/kendo-ui)
 Moment.js (http://momentjs.com/)
Moment.js
 Date arithmetic
 moment().add(‘day’, 5);
 Date formatting
DataJS
 Description
 OData client for JavaScript
 Location
 http://datajs.codeplex.com
 Features
 Cross-browser support
 Data caching
 Batch operations
Retrieving OData
"../_api/web/lists/getByTitle(‘SoftwareOrder')/itemCount"
"GET"
"accept" "application/json;odata=verbose"
function
Caching Data
var
"contacts"
"../_api/web/lists/getByTitle(‘SoftwareOrder')/items"
"?$select=Id,Title,SoftwareCategory,UserName"
"&$orderby=Title"
JavaScript Library: SPServices
 SPServices
(http://spservices.codeplex.com/)
JavaScript Snippet: JavaScript on all Pages
 Registering JavaScript on All Pages in
Office 365
Recap
We Looked at…
- JavaScript best practices
- JavaScript libraries
Utility Libraries
Data access Libraries
Application Development Frameworks
Libraries that Enhance User Interface
- Developing application for Office 365 SharePoint and use of
JavaScript libraries
References
- Codeplex
- Github OfficeDev/Pnp
- Youtube, MSDN and other sites on the web
Thank you.

Mais conteúdo relacionado

Mais procurados

AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) PresentationRaghubir Singh
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談awonwon
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSmurtazahaveliwala
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to conceptsAbhishek Sur
 
Angular js presentation at Datacom
Angular js presentation at DatacomAngular js presentation at Datacom
Angular js presentation at DatacomDavid Xi Peng Yang
 
Introduction of angular js
Introduction of angular jsIntroduction of angular js
Introduction of angular jsTamer Solieman
 
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using nowAtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using nowAtlassian
 
AtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and ServerAtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and ServerAtlassian
 
AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-onsAtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-onsAtlassian
 
IndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsIndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsAdégòkè Obasá
 
Introduction to single page application with angular js
Introduction to single page application with angular jsIntroduction to single page application with angular js
Introduction to single page application with angular jsMindfire Solutions
 
TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5Tieturi Oy
 

Mais procurados (20)

AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
 
ASP .net MVC
ASP .net MVCASP .net MVC
ASP .net MVC
 
Angular JS
Angular JSAngular JS
Angular JS
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
 
Angular js
Angular jsAngular js
Angular js
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
 
AngularJS
AngularJSAngularJS
AngularJS
 
Angular js presentation at Datacom
Angular js presentation at DatacomAngular js presentation at Datacom
Angular js presentation at Datacom
 
Introduction of angular js
Introduction of angular jsIntroduction of angular js
Introduction of angular js
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using nowAtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using now
 
AtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and ServerAtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and Server
 
React JS .NET
React JS .NETReact JS .NET
React JS .NET
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-onsAtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-ons
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
 
IndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsIndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web Apps
 
Introduction to single page application with angular js
Introduction to single page application with angular jsIntroduction to single page application with angular js
Introduction to single page application with angular js
 
TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5
 

Semelhante a SharePoint Saturday Atlanta 2015

AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep DiveGabriel Walt
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگوrailsbootcamp
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!David Gibbons
 
django_introduction20141030
django_introduction20141030django_introduction20141030
django_introduction20141030Kevin Wu
 
Django cheat sheet
Django cheat sheetDjango cheat sheet
Django cheat sheetLam Hoang
 
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...JavaScripters Community
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsSami Ekblad
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code IgniterAmzad Hossain
 
James Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 PatternsJames Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 Patternsakqaanoraks
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkRapidValue
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineYared Ayalew
 
intro to Angular js
intro to Angular jsintro to Angular js
intro to Angular jsBrian Atkins
 
China Science Challenge
China Science ChallengeChina Science Challenge
China Science Challengeremko caprio
 

Semelhante a SharePoint Saturday Atlanta 2015 (20)

AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگو
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
Pyramid patterns
Pyramid patternsPyramid patterns
Pyramid patterns
 
django_introduction20141030
django_introduction20141030django_introduction20141030
django_introduction20141030
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
 
Django cheat sheet
Django cheat sheetDjango cheat sheet
Django cheat sheet
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJS
 
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
 
James Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 PatternsJames Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 Patterns
 
Angular Seminar-js
Angular Seminar-jsAngular Seminar-js
Angular Seminar-js
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular Framework
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
intro to Angular js
intro to Angular jsintro to Angular js
intro to Angular js
 
Google Cloud Platform
Google Cloud Platform Google Cloud Platform
Google Cloud Platform
 
China Science Challenge
China Science ChallengeChina Science Challenge
China Science Challenge
 

Último

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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 convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
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
 
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
 
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
 
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
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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 convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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
 
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
 
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...
 
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
 
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...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 

SharePoint Saturday Atlanta 2015

  • 2. My Background  Senior SharePoint and Web developer / Application Architect
  • 3. Agenda - JavaScript: - Why use JavaScript? - Best Practices - SharePoint app using some useful JavaScript libraries - Utility Libraries - Data access Libraries - Application Development Frameworks - Libraries that Enhance User Interface
  • 4. Why use JavaScript?  Traditional SharePoint development  On premises development  Server side code  App development  In the cloud  Client side code
  • 5. JavaScript Best Practices  Strict mode  Equality operators  Encapsulation  Promises
  • 6. Always use strict mode  Declared with "use strict"  Restrictions  Cannot use a variable without declaring it  Cannot write to a read-only property  Cannot add properties to non-extensible objects  Cannot illegally delete functions and variables  Cannot define a property more than once in an object literal  Cannot use a parameter name more than once in a function  Cannot use reserved words, eval, or arguments, as names for functions and variables  The value of this in a function is no longer the window object  Cannot declare functions inside of statements  Cannot change the members of the arguments array
  • 7. Always use === == Vs === != Vs !==
  • 8. JavaScript scopes  Scope is at function level  var is “private”  this. is “public”  No block level scope
  • 9. Encapsulate your code  Singleton pattern  Module pattern  Prototype pattern
  • 10. Using the Singleton pattern var department = { name: "Sales", getDepartmentInfo: function () { alert("Department name is '" + this.name + "'"); } }; department.getDepartmentInfo();
  • 11. Using the Module pattern var Organization = {}; Organization.Module = {}; Organization.Module.Department = function () { //private members var name, setDepartmentInfo = function (n) { this.name = n; }, getDepartmentInfo = function () { alert(this.name); }; //public interface return { setDepartmentInfo: setDepartmentInfo, getDepartmentInfo: getDepartmentInfo } }(); // self invoking function // Advantages: Hides function members, Can use private and public members
  • 12. Using the Prototype pattern var Organization = {}; Organization.Department = function (n) { this.name = n }; Organization.Department.prototype = { getDepartmentInfo: function () { alert(this.name); } }; var department = new Organization.Department("Sales"); department.getDepartmentInfo(); // every object in JavaScript has prototype // use of the keyword new // useful for creating a lots of instances of one object
  • 13. Promises  Also called “Deferreds”  Simplify asynchronous operations
  • 15. JavaScript Libraries  Utility Libraries  jQuery  SPServices  Data Libraries  DataJS  Application Framework Library  AngularJS  UI Library  DataTables.js  KendoUI
  • 16. Deploying JavaScript Files  Content Delivery Networks (CDNs)  Use https  Monkey-Patching  Under Layouts folder  Farm solutions  Virtual File Systems  Document Libraries  Sandboxed solutions, Apps
  • 17. Using the SharePoint RESTful endpoint _api is alias for _vti_bin/client.svc Custom Client Code JavaScript Library Server Client .Net CLR
  • 18. Overview of SharePoint & Office 365 JavaScript Options  Content Editor Web Part  Script Editor Web Part  SharePoint Designer  <ScriptLink> or <Script>  Server Side Code Injection  RegisterClientScriptBlock vs RegisterStartupScript  Web Parts/Delegate Controls/Application Pages  CSS JavaScript Injection
  • 19. Advantages of ScriptLink over Script element  Dependency loading  Localized version of your library  Control over when the file gets added  Doesn’t load the file multiple times if it’s already loaded once, this improves performance  The ScriptLink element provides benefit only when your library files reside in layouts folder, if you are side loading the script files, you will not get any real benefit with ScriptLink element
  • 20. Angular.js  Description  Implements Model-View-Controller (MVC) for JavaScript  Location  http://angularjs.org/  https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js  NuGet  Features  Model-View-Controller  Data Binding  Routing  Directives  Factories
  • 22. Modules  A container for the components of the app //module var myapp = angular.module(“myApp", []); <!-- html --> <div data-ng-app = "MyApp"> Reference dependent modules
  • 23. Directives  Utilizes HTML5 custom data attributes  Allows for the addition of custom attributes starting with data-  Angular uses directives for declarative programming  Angular directives start with “ng-”  data-ng-app, defines scope of the framework  data-ng-controller, invokes a controller  data-ng-click, handles click event
  • 24. Directives <!DOCTYPE html> <html data-ng-app=“myApp”> <head></head> <body> <input type="text" data-ng-model="displayName"/> <div data-ng-click="update" ng-controller="myCtrl"> </div> </body> </html> Initializes the app. Can be anonymous or named. Creates a property on the ViewModel References a controller named “myCtrl”, which creates a new ViewModel. References a controller method to call on a click event
  • 25. Simple Data Binding <div ng-app=“myApp"> <div ng-controller="myCtrl"> <input type="text" data-ng-model="firstName"/> <div>{{firstName}}</div> </div> </div> • Binds ViewModels to HTML elements • Uses {{…}} syntax • References a property of a ViewModel • Supports two-way binding This example will display whatever the user types
  • 26. Controllers //controller myapp.controller(“myCtrl", ["$scope", function welcomeCtrl($scope) { //model $scope.welcomeMessage = "Hi"; } ); <!-- html --> <div data-ng-controller=“myCtrl"> • Build up the $scope (a.k.a, View Model)
  • 27. View Binding <div ng-app=“myApp"> <div ng-controller=“myCtrl"> <h3>{{welcomeMessage}}</h3> </div> </div> • Bind the $scope to the HTML elements
  • 29. Angular-1 View Synchronization •Declarative •Separation between template and code •Two-way data binding •Stateful •Nested Scopes (Controller As) •Unidirectional flow
  • 30. Angular-2 what’s coming • Still declarative • Separation between template and code • 3 types of directives – components (directives, controllers), decorators, templates (transformative, e.g. ng-if) • Support for unidirectional data flow • Three models: stateful, reactive, immutable • Controllers are folded into components
  • 31. JavaScript Library: DataTables  DataTables (http://www.datatables.net/)
  • 32. JavaScript Libraries  KendoUI (http://www.telerik.com/kendo-ui)  Moment.js (http://momentjs.com/)
  • 33. Moment.js  Date arithmetic  moment().add(‘day’, 5);  Date formatting
  • 34. DataJS  Description  OData client for JavaScript  Location  http://datajs.codeplex.com  Features  Cross-browser support  Data caching  Batch operations
  • 37. JavaScript Library: SPServices  SPServices (http://spservices.codeplex.com/)
  • 38. JavaScript Snippet: JavaScript on all Pages  Registering JavaScript on All Pages in Office 365
  • 39. Recap We Looked at… - JavaScript best practices - JavaScript libraries Utility Libraries Data access Libraries Application Development Frameworks Libraries that Enhance User Interface - Developing application for Office 365 SharePoint and use of JavaScript libraries
  • 40. References - Codeplex - Github OfficeDev/Pnp - Youtube, MSDN and other sites on the web