Using Promise Patterns with Java Script j Query
























- Slides: 24

Using Promise Patterns with Java. Script, j. Query, and the Share. Point 2013 App Model Doug Hemminger Share. Point Solutions Architect, Protiviti


Agenda • Share. Point 2013 App Primer • Java. Script “Function” Primer • Asynchronous Patterns in Java. Script



App Shapes

Terminology Host Web – A Share. Point website where the app is installed and surfaced to the user. App Web – An isolated Share. Point web site on the Share. Point app domain that hosts Share. Point components used in the app

Hosting Architectures Share. Point Hosted – App is hosted by Share. Point Provider Hosted – App is hosted on a dedicated server either on-premises or on a third party hosting service


Share. Point-hosted Apps Runs on an isolated app domain of the Share. Point farm Authorized using the privileges of the signed in user Can only use Java. Script and HTML- No server side code

Provider-hosted Apps Runs on a dedicated server or hosting service (not in Share. Point) Authorization is through OAuth or the Java. Script cross -domain library Can use any language supported by the web server or hosting service


Java. Script Functions are Objects in Java. Script. Essentially they are strings of Java. Script code.


Asynchronous Patterns Callbacks Events Promises

Callbacks A callback is a function that is passed to another function as a parameter and somehow affects the flow of execution Functions are Objects in Java. Script

Callback


Promises A promise represents the eventual value returned from the single completion of an operation. Three states • Unfullfilled • Fulfilled • Rejected

Promises In j. Query the Promise pattern can be used with $. when(object) where object is a deferred object or a promise



Title Url Choose patterns for developing and hosting your app for Share. Point http: //msdn. microsoft. com/enus/library/office/fp 179887(v=office. 15). aspx Host webs, app webs, and Share. Point components in Share. Point 2013 http: //msdn. microsoft. com/enus/library/office/fp 179925(v=office. 15). aspx Apps for Office and Share. Point Blog http: //blogs. msdn. com/b/officeapps/ Showcase: Contoso Incubation Search App http: //msdn. microsoft. com/en-US/office/dn 594490 Asynchronous Programming in Java. Script with “Promises” http: //blogs. msdn. com/b/ie/archive/2011/09/11/asyn chronous-programming-in-javascript-withpromises. aspx Promise Patterns http: //modernjavascript. blogspot. com/2013/09/prom ise-patterns. html Understand Java. Script callback functions and use them http: //javascriptissexy. com/understand-javascriptcallback-functions-and-use-them/

Title Url Understanding Callbacks in Java. Script http: //recurial. com/programming/understandingcallback-functions-in-javascript/