Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body>
  <div id="_progress"></div>
  <article>
    <h1 style="text-align:center;font-size:72px;font-family:'Consolas'">Start scrolling this page</h1>
    <h1 id="install-the-durable-functions-extension-and-samples-azure-functions-">Install the Durable Functions extension and samples (Azure Functions)</h1>
    <p>The <a href="durable-functions-overview.md">Durable Functions</a> extension for <code>Azure Functions</code> is provided in the NuGet package <a href="https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask">Microsoft.Azure.WebJobs.Extensions.DurableTask</a>.
      This article shows how to install the package and a set of samples for the following development environments:</p>
    <ul>
      <li>Visual Studio 2017 (Recommended for C#) </li>
      <li>Visual Studio Code (Recommended for JavaScript)</li>
      <li>Azure portal</li>
    </ul>
    <h2 id="visual-studio-2015">Visual Studio 2015</h2>
    <p>Visual Studio currently provides the best experience for developing apps that use Durable Functions. Your functions can be run locally and can also be published to Azure. You can start with an empty project or with a set of sample functions.</p>
    <h3 id="prerequisites">Prerequisites</h3>
    <ul>
      <li>Install the <a href="https://www.visualstudio.com/downloads/">latest version of Visual Studio</a> (version 15.3 or greater). Include the <strong>Azure development</strong> workload in your setup options.</li>
    </ul>
    <h3 id="start-with-sample-functions">Start with sample functions</h3>
    <ol>
      <li>Download the <a href="https://azure.github.io/azure-functions-durable-extension/files/VSDFSampleApp.zip">Sample App .zip file for Visual Studio</a>. You don't need to add the NuGet reference because the sample project already has it.</li>
      <li>Install and run <a href="https://docs.microsoft.com/azure/storage/storage-use-emulator">Azure Storage Emulator</a> version 5.2 or later. Alternatively, you can update the <em>local.appsettings.json</em> file with real Azure Storage connection strings.</li>
      <li>Open the project in Visual Studio 2017. </li>
      <li>For instructions on how to run the sample, start with <a href="durable-functions-sequence.md">Function chaining - Hello sequence sample</a>. The sample can be run locally or published to Azure.</li>
    </ol>
    <h3 id="start-with-an-empty-project">Start with an empty project</h3>
    <p>Follow the same directions as for starting with the sample, but do the following steps instead of downloading the <em>.zip</em> file:</p>
    <ol>
      <li>Create a Function App project.</li>
      <li>Search for the following NuGet package reference using <em>Manage NuGet Packages</em> and add it to the project: Microsoft.Azure.WebJobs.Extensions.DurableTask v1.4.0 (check <em>Include prerelease</em> to search for this package)</li>
    </ol>
    <h2 id="visual-studio-code">Visual Studio Code</h2>
    <p>Visual Studio Code provides a local development experience covering all major platforms - Windows, macOS, and Linux. Your functions can be run locally and also be published to Azure. You can start with an empty project or with a set of sample functions.</p>
    <h3 id="prerequisites">Prerequisites</h3>
    <ul>
      <li>
        <p>Install the <a href="https://code.visualstudio.com/Download">latest version of Visual Studio Code</a> </p>
      </li>
      <li>
        <p>Follow the instructions under "Install the Azure Functions Core Tools" at <a href="https://docs.microsoft.com/azure/azure-functions/functions-run-local">Code and test Azure Functions locally</a></p>
        <blockquote>
          <p>[!IMPORTANT] If you already have the Azure Functions Cross Platform Tools, update them to the latest available version.</p>
        </blockquote>
        <blockquote>
          <p>[!IMPORTANT] Durable Functions in JavaScript requires version 2.x of the Azure Functions Core Tools.</p>
        </blockquote>
      </li>
      <li>
        <p>If you are on a Windows machine, install and run <a href="https://docs.microsoft.com/azure/storage/storage-use-emulator">Azure Storage Emulator</a> version 5.2 or later. Alternatively, you can update the <em>local.appsettings.json</em> file with
          real Azure Storage connection. </p>
      </li>
    </ul>
    <h3 id="start-with-sample-functions">Start with sample functions</h3>
    <h4 id="c-">C#:</h4>
    <ol>
      <li>Clone the <a href="https://github.com/Azure/azure-functions-durable-extension.git">Durable Functions repository</a>.</li>
      <li>Navigate on your machine to the <a href="https://github.com/Azure/azure-functions-durable-extension/tree/master/samples/csx">C# script samples folder</a>. </li>
      <li>
        <p>Install Azure Functions Durable Extension by running the following in a command prompt / terminal window:</p>
        <pre class=" language-bash"><code class=" language-bash"> func extensions install -p Microsoft.Azure.WebJobs.Extensions.DurableTask -v 1.4.0</code></pre>
      </li>
      <li>
        <p>Install Azure Functions Twilio Extension by running the following in a command prompt / terminal window:</p>
        <pre class=" language-bash"><code class=" language-bash"> func extensions install -p Microsoft.Azure.WebJobs.Extensions.Twilio -v 3.0.0-beta5</code></pre>
      </li>
      <li>Run Azure Storage Emulator or update the <em>local.appsettings.json</em> file with real Azure Storage connection string.</li>
      <li>Open the project in Visual Studio Code. </li>
      <li>For instructions on how to run the sample, start with <a href="durable-functions-sequence.md">Function chaining - Hello sequence sample</a>. The sample can be run locally or published to Azure.</li>
      <li>Start the project by running in command prompt / terminal the following command:
        <pre class=" language-bash"><code class=" language-bash"> func host start</code></pre>
      </li>
    </ol>
    <h4 id="javascript-functions-v2-only-">JavaScript (Functions v2 only)</h4>
    <ol>
      <li>Clone the <a href="https://github.com/Azure/azure-functions-durable-extension.git">Durable Functions repository</a>.</li>
      <li>Navigate on your machine to the <a href="https://github.com/Azure/azure-functions-durable-extension/tree/master/samples/javascript">JavaScript samples folder</a>. </li>
      <li>
        <p>Install Azure Functions Durable Extension by running the following in a command prompt / terminal window:</p>
        <pre class=" language-bash"><code class=" language-bash"> func extensions install -p Microsoft.Azure.WebJobs.Extensions.DurableTask -v 1.4.0</code></pre>
      </li>
      <li>
        <p>Restore the npm packages by running the following in a command prompt / terminal window:</p>
        <pre class=" language-bash"><code class=" language-bash"> npm install</code></pre>
      </li>
      <li>Update the <em>local.appsettings.json</em> file with the real Azure Storage connection string.</li>
      <li>Open the project in Visual Studio Code. </li>
      <li>For instructions on how to run the sample, start with <a href="durable-functions-sequence.md">Function chaining - Hello sequence sample</a>. The sample can be run locally or published to Azure.</li>
      <li>Start the project by running in command prompt / terminal the following command:
        <pre class=" language-bash"><code class=" language-bash"> func host start</code></pre>
      </li>
    </ol>
    <h3 id="start-with-an-empty-project">Start with an empty project</h3>
    <ol>
      <li>In command prompt / terminal navigate to the folder that will host your function app.</li>
      <li>
        <p>Install the Azure Functions Durable Extension by running the following in a command prompt / terminal window:</p>
        <pre class=" language-bash"><code class=" language-bash"> func extensions install -p Microsoft.Azure.WebJobs.Extensions.DurableTask -v 1.4.0</code></pre>
      </li>
      <li>
        <p>Create a Function App project by running the following command:</p>
        <pre class=" language-bash"><code class=" language-bash"> func init</code></pre>
      </li>
      <li>Run Azure Storage Emulator or update the <em>local.appsettings.json</em> file with real Azure Storage connection string.</li>
      <li>
        <p>Next, create a new function by running the following command and follow the wizard steps:</p>
        <pre class=" language-bash"><code class=" language-bash"> func new</code></pre>
        <blockquote>
          <p>[!IMPORTANT] Currently the Durable Function template is not available but you can start with one of the supported options and then modify the code. Use for reference the samples for <a href="https://github.com/Azure/azure-functions-durable-extension/tree/master/samples/csx/HttpStart">Orchestration Client</a>,
            <a href="https://github.com/Azure/azure-functions-durable-extension/tree/master/samples/csx/E1_HelloSequence">Orchestration Trigger</a>, and <a href="https://github.com/Azure/azure-functions-durable-extension/tree/master/samples/csx/E1_HelloSequence">Activity Trigger</a>.</p>
        </blockquote>
      </li>
      <li>
        <p>Open the project folder in Visual Studio Code and continue by modifying the template code. </p>
      </li>
      <li>Start the project by running in command prompt / terminal the following command:
        <pre class=" language-bash"><code class=" language-bash"> func host start</code></pre>
      </li>
    </ol>
    <h2 id="azure-portal">Azure portal</h2>
    <p>If you prefer, you can use the Azure portal for Durable Functions development.</p>
    <blockquote>
      <p>[!NOTE] Durable Functions in JavaScript are not yet available in the portal.</p>
    </blockquote>
    <h3 id="create-an-orchestrator-function">Create an orchestrator function</h3>
    <ol>
      <li>
        <p>Create a new function app at <a href="https://functions.azure.com/signin">functions.azure.com</a>.</p>
      </li>
      <li>
        <p>Configure the function app to <a href="set-runtime-version.md">use the 2.0 runtime version</a>.</p>
        <p>The Durable Functions extension works on both the 1.X runtime and the 2.0 runtime, but the Azure Portal templates are only available when targeting the 2.0 runtime.</p>
      </li>
      <li>
        <p>Create a new function by selecting <strong>"create your own custom function."</strong>.</p>
      </li>
      <li>
        <p>Change the <strong>Language</strong> to <strong>C#</strong>, <strong>Scenario</strong> to <strong>Durable Functions</strong> and select the <strong>Durable Functions Http Starter - C#</strong> template.</p>
      </li>
      <li>
        <p>Under <strong>Extensions not installed</strong>, click <strong>Install</strong> to download the extension from NuGet.org. </p>
      </li>
      <li>
        <p>After the installation is complete, proceed with the creation of an orchestration client function – <strong>“HttpStart”</strong> that is created by selecting <strong>Durable Functions Http Starter - C#</strong> template.</p>
      </li>
      <li>
        <p>Now, create an orchestration function <strong>“HelloSequence”</strong> from <strong>Durable Functions Orchestrator - C#</strong> template.</p>
      </li>
      <li>
        <p>And the last function will be called <strong>“Hello”</strong> from <strong>Durable Functions Activity - C#</strong> template.</p>
      </li>
      <li>
        <p>Go to <strong>"HttpStart"</strong> function and copy its URL.</p>
      </li>
      <li>
        <p>Use Postman or cURL to call the durable function. Before testing, replace in the URL <strong>{functionName}</strong> with the orchestrator function name - <strong>HelloSequence</strong>. No data is required, just use POST verb. </p>
        <pre class=" language-bash"><code class=" language-bash">curl -X POST https://{your function app name}.azurewebsites.net/api/orchestrators/HelloSequence</code></pre>
      </li>
      <li>
        <p>Then, call the <strong>“statusQueryGetUri”</strong> endpoint and you see the current status of the Durable Function</p>
        <pre class=" language-json"><code class=" language-json">    {
        "runtimeStatus": "Running",
        "input": null,
        "output": null,
        "createdTime": "2017-12-01T05:37:33Z",
        "lastUpdatedTime": "2017-12-01T05:37:36Z"
    }</code></pre>
      </li>
      <li>
        <p>Continue calling the <strong>“statusQueryGetUri”</strong> endpoint until the status changes to <strong>"Completed"</strong> </p>
        <pre class=" language-json"><code class=" language-json">{
        "runtimeStatus": "Completed",
        "input": null,
        "output": [
            "Hello Tokyo!",
            "Hello Seattle!",
            "Hello London!"
        ],
        "createdTime": "2017-12-01T05:38:22Z",
        "lastUpdatedTime": "2017-12-01T05:38:28Z"
    }</code></pre>
      </li>
    </ol>
    <p>Congratulations! Your first durable function is up and running in Azure Portal!</p>

  </article>
</body>
              
            
!

CSS

              
                body {
  margin: 0px;
  border: 0px;
  padding: 0px;
}
article {
  margin: 0px;
  border: 0px;
  padding: 0px 40px;
}
#_progress {
  --scroll: 0%;
  background: linear-gradient(
    to right,
    rgb(0, 143, 105) var(--scroll),
    transparent 0
  );
  position: fixed;
  width: 100%;
  height: 5px;
  top: 0px;
  z-index: 100;
}

              
            
!

JS

              
                document.addEventListener(
  "scroll",
  function() {
    var scrollTop =
      document.documentElement["scrollTop"] || document.body["scrollTop"];
    var scrollBottom =
      (document.documentElement["scrollHeight"] ||
        document.body["scrollHeight"]) - document.documentElement.clientHeight;
    scrollPercent = scrollTop / scrollBottom * 100 + "%";
    document
      .getElementById("_progress")
      .style.setProperty("--scroll", scrollPercent);
  },
  { passive: true }
);

              
            
!
999px

Console