Your SlideShare is downloading. ×
JSOM and java script practices
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

JSOM and java script practices

1,311
views

Published on

JSOM need best practices of JQuery and Javascripts

JSOM need best practices of JQuery and Javascripts

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,311
On Slideshare
0
From Embeds
0
Number of Embeds
32
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. JSOM Practices in SharePoint Melick Baranasooriya melick-rajee.blogspot.com
  • 2. SharePoint Environment Need Environment For Connect Dlls SharePoint Client Can Use SharePoint Online Dlls SharePoint No Dll References Administrator SharePoint Client Runtime JavaScript JSOM SharePoint Development Sandbox Solutions No Need CSOM Farm Solutions SSOM Need SharePoint Environment
  • 3.  Interpreted Language  Prototype based language JavaScript  style of object-oriented programming  Support Inheritance  Dynamic Types  Standardize as ECMAScript
  • 4. x = "SomeName"; function Add() { x = "Add"; console.log("Add"); General Practices } //Functions is this correct ? window.Add(); //Global variables,window object console.log( window.x );
  • 5. Window Object Window.add = function () { Window.x = “SomeName” };
  • 6. Self-Executing Anonymous Function (function(mySpace,undefined ) { Own Namespace }( window.mySpace = window.mySpace || {}));  Check the global space for mySpace and assign a new one if not available  Leave the undefined as undefined.
  • 7. (function(mySpace,undefined ) { //Private var x = 1; //Public Properties mySpace.y = "2"; }( window.mySpace = window.mySpace || {})); Console.log(mySpace.y) Console.log(mySpace.x) – Not accessible
  • 8. (function(mySpace,undefined ) { //Public mySpace.add = function() { console.log("Add") }; Methods //Private function addItem( ) { console.log("AddItem") } }( window.mySpace = window.mySpace || {}));
  • 9. mySpace.Class1 = function () { }; mySpace.Class1.prototype = { methodOne: function () { return "methodOne"; }, Classes and Objects methodTwo: function (para) { console.log(para); } }; var a = new Class1(); a.methodOne();
  • 10.  Use Js files available in Web Server Extensions15TEMPLATELAYOUTS JSOM JavaScript Object Model
  • 11.  SharePoint Hosted SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () { // Do });  Provider Hosted JSOM <script type="text/javascript" src="/_layouts/15/MicrosoftAjax.js"></script> <script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script> <script type="text/javascript" src="/_layouts/15/sp.js"></script>
  • 12. Single Reference Pattern https://srj.code plex.com/
  • 13. ? Thank You