edit-task
Home
Up
Delete
Task Name:
Task Description:
[idx] PASS - query deferred - mastering the art of the promise
TaskGroup ID:
Start Date:
Start Time:
Duration:
Priority:
Status:
To Do
Completed
In Process
Add Photo:
Owner ID:
Content:
use HTML
Edit Content
<h1 style="text-align: center;">CREATE-article# #</h1> <h2>[previously]</h2> <ol> <li><strong>[2017-08-25][00:00] NEW task IN ?</strong></li> <ol> <li>] # 7389 - CREATE-article# # </li> </ol> <li><strong>[00:00] NEW article IN </strong></li> <ol> <li>] # # - jquery defferred - mastering the art of the promise </li> </ol></ol> <h2>[currently]</h2> <ol> <li><strong>[] PASS - </strong></li> <ol> <li>] </li> <li>] EXAMPLE </li> </ol> <li><strong>[] </strong></li> <li><strong>[] todo</strong></li> <ol> <li>x] add create-article task, # 7389, this</li> <li>x] add reference to this task on index</li> <li>x] add reference to index on this task</li> <li>] </li> <li>] content - add reference to video tutorials ( get BM from saf)</li> <li>] content - add notes from scrap</li> <li>]</li> </ol></ol> <h2>[next]</h2> <ol> <li>]</li> <li>] entering the lovely world of asynch calllback handling with </li> <li>] the OnSuccess callback being passed to so many</li> <li>] var OnSuccess - defining the OnSuccess callback handler in your , EX on pg </li> </ol> <h2>[reference]</h2> <div><ol> <li>] # 7380 - project-00n - <a href="/view/task?id=7380" target="_blank">index</a> - list of all articles related to this project </li> <li>] # 7354 - LIST-contract#-026 - previous notes on jq deferred / js promises</li> <li>] # 7376 - 2017-06-20 - misc </li> <li>] <a href="https://www.youtube.com/watch?v=zD-JoRDk8ig">Promises, Promises: Unlocking the Power of jQuery's Deferreds - Brian Klaas - YouTube</a> </li> <li>] <a href="https://www.youtube.com/watch?v=104J7_HyaG4" target="_blank">How to Use Javascript Promises - YouTube</a> </li> <li>] <a href="https://www.youtube.com/watch?v=swdWUWtGxR4" target="_blank">JavaScript Promises: The Basics - YouTube</a> </li> <li>] <a href="https://www.youtube.com/watch?v=bcjq3koKpFE" target="_blank">An Intro to AJAX Promises in jQuery - YouTube</a> </li> <li>] youtube ? = 'jquery deferred tutorial'</li> </ol><hr /> </div> <div>] Promises are a cleaner way of doing javascript callbacks</div> <div>] better way of handling 'asynch' operations</div> <div>] promise are part of the js standard in es6</div> <div>] use 1 deferred object VS using multiple callbacks, ex ( OnSuccess, OnFailure, ...)</div> <div>] promises have a 'status' property, the status can be either 'pending' or 'resolved'</div> <div>] the status property is immutiable, aka it cannot be changed by other objects code, other then when the . </div> <div><hr /><strong>EXAMPLE - generic</strong></div> <div>return $.deferred => {</div> <div>$.when( getSomething() )</div> <div>.done( (something) </div> <div>doSomething(something) )</div> <div>}.promise();</div> <div> </div> <div><hr /><strong>EXAMPLE - specific - single object </strong></div> <div>return $.deferred => {</div> <div>$.when ( getAvailableCar() )</div> <div>.done((car) => { </div> <div> car.availability = false;</div> <div>// process EX = carsAvailable.push(car);</div> <div> </div> <div>}) </div> <div>}.promise(); </div>