Coder Social home page Coder Social logo

tarqd / launchdarkly-html-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yozlet/launchdarkly-html-sdk

0.0 1.0 0.0 5 KB

Use LaunchDarkly feature flags with the internet's most popular programming language

JavaScript 75.53% HTML 24.47%

launchdarkly-html-sdk's Introduction

LaunchDarkly HTML SDK

A module for controlling browser HTML with LaunchDarkly feature flags. It can be included in an HTML page without having to write any additional Javascript.

Motivation

At last, LaunchDarkly support for the internet's most popular programming language.

With the addition of the LaunchDarkly HTML SDK, you can use feature flags to:

  • add or remove CSS classes
  • change the text content
  • change an attribute value

... in any HTML element in the page, without writing Javascript. (But Javascript support is still required.)

This module is based on the LaunchDarkly Javascript SDK.

Examples

<!-- Adds the "blue-bg" class to this element
    when the "blue-panel" flag evaluates to true 
-->
<div data-ld-key="blue-panel" data-ld-addclass="blue-bg"></div>

<!-- after successful connection to LaunchDarkly or a proxy, this
    will evaluate the "h1-content" flag and replace the
    current inner text with the result; otherwise, the existing
    inner text will remain
-->
<h1 data-ld-key="h1-content" data-ld-innertext>Old Heading<h1>

Usage

Add the module to your page using a <script> tag. Note the addition of the data-ld-clientkey attribute.

<script src="launchdarkly-html-sdk.js" data-ld-clientkey="ADD YOUR CLIENT KEY HERE"></script>

Once loaded, the SDK will attempt to make a connection to the LaunchDarkly servers. After the connection is complete, all data-ld attributes in the page will be evaluated and their elements updated. There will be further updates as events warrant.

Known Issues

No user/context object

There are plenty of possible ways to do this, not just in the page; it may be useful for site cookies to be included.

No support for multiple projects or environments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.