OfficeDev / hands-on-labs

This repo represents the content for the Coding Challenges, typically used for Microsoft Developer Events (i.e. //build)
27 stars 25 forks source link

Update stockprice to use "fetch" and follow best practices #148

Closed Zlatkovsky closed 6 years ago

Zlatkovsky commented 6 years ago

A number of updates:

  1. Use "fetch" instead of XHR, for easier usability.
  2. Have the stockPriceStream function follow best-practices: such as adding an onCancelled, making sure that if interval is too quick that we skip to next iteration, and add error handling.
  3. Minor stuff (e.g., fix invalid extra comma in JSON)
mscharlock commented 6 years ago

FWIW I think the reason we used XHR originally was to demonstrate the new XHR API that you can use in CFs. But, agreed that fetch typically is easier.

kbrandl commented 6 years ago

@mscharlock thanks for testing this and confirming that it works on the VM that's being used for the Custom Functions hands-on lab. I've merged the PR, so from now on when someone launches the lab, they should get these updated instructions.