Extensions 101 – But it worked yesterday … now what?!?


Recently Niel Zeeman mentioned that he ran into an issue doing an extension demo, where it worked perfectly fine the day before. If you would like to understand how he debugged and solved the issue, stay with us.

But first, a crisp demo video from Niel: image

Gems to highlight:

  • You can find the mentioned Extension Project Template here.
  • Recommended configuration settings for debugging:
    • Generate sources maps. Here’s more info.
      image
    • Configure the URL you will be debugging as the Start URL:
      image
  • Code change:
    • Before:
      execute: function (actionContext) {
          var sourcecontext = actionContext;
          if (( sourceContext.item.sourceProvider == "Tfvc”) && (sourceContext.item.item.isBranch)) {
              …
          }
      }
    • After:
      execute: function (actionContext) {
         
      actionContext.getSourceItemContext().then(function (sourceContext) {
              if (( sourceContext.item.sourceProvider == "Tfvc”) && (sourceContext.item.item.isBranch)) {
                  …
              }
          }
      }
  • What’s a “Promise”?

    • “A promise represents the eventual value returned from the single completion of an operation”, Promises/A.

Thanks Niel for sharing!

We need your feedback!

Do you have a question, feedback, or an interest to join the early adopters? Add a comment below or ping us here.

Comments (0)

Skip to main content