Code Monkey home page Code Monkey logo

leanplum-javascript-sdk's Introduction

Leanplum -

Build status      Build status

License: Apache 2.0

Leanplum-JavaScript-SDK

This is the JavaScript SDK for Leanplum, allowing developers to access and integrate the functionality of Leanplum with applications and devices through JavaScript and HTML5. Leanplum is an application development platform that provides mobile A/B testing, messaging functionality, personalization, and more features for applications.

Installation

Add leanplum.js to your project:

<script type="text/javascript" src="leanplum.js"></script>

Usage

Initialize Leanplum.

// This value should be set to true only if you're developing on your server.
var isDevelopmentMode = true;
 
// Sample variables. This can be any JSON object.
var variables = {
  items: {
    color: 'red',
    size: 20,
    showBadges: true
  },
  showAds: true
};
 
// Insert your API keys here.
if (isDevelopmentMode) {
  Leanplum.setAppIdForDevelopmentMode("APP_ID", "DEVELOPMENT_KEY");
} else {
  Leanplum.setAppIdForProductionMode("APP_ID", "PRODUCTION_KEY");
}
 
Leanplum.setVariables(variables);
Leanplum.start(function(success) {
  console.log('Success: ', success);
  console.log('Variables: ', Leanplum.getVariables());
});

Development

Setup

Install yarn package manager and run have it install all dependencies.

npm i -g yarn
yarn install

Tasks

  • yarn start - Starts the grunt watch daemon for development.
  • yarn run lint - Lints all files.
  • yarn run build - Builds a distribution version of the library.
  • yarn run test - Runs the unit tests.

Testing

Run tests: mocha -r mock-local-storage -r test/specs/helpers/setup.js -r test/specs/helpers/chai.js test/specs/testLeanplum.js

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b feature/my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin feature/my-new-feature
  5. Submit a pull request to develop branch.

Release / Building

  • git flow release start "NEW_VERSION"
  • yarn install
  • ./bump_version.sh OLD_VERSION NEW_VERSION
  • grunt build
  • grunt test
  • git flow release finish "NEW_VERSION"

Test Coverage

Run: npm i -g nyc nyc mocha -r mock-local-storage -r test/specs/helpers/setup.js -r test/specs/helpers/chai.js test/specs/testLeanplum.js

License

See LICENSE file.

leanplum-javascript-sdk's People

Contributors

benmarten avatar nikitakurpas avatar milos1290 avatar e7mac avatar vincent-re avatar alexisoyama avatar maitreyabuddha avatar nzagorchev avatar

Watchers

Billy Chang avatar Simon Russell avatar Cheng Huang avatar Danny Brain avatar Kruti Patel avatar Adam Brady avatar James Cloos avatar Richard Moult avatar Jaco Nel avatar Jiri Musil avatar Martin Ducar avatar lim.json avatar Tomáš Kletzander avatar  avatar Michael Vescovo avatar  avatar

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.