Coder Social home page Coder Social logo

planout.js's Introduction

PlanOut.js

============= PlanOut.js is a JavaScript-based implementation of PlanOut. It provides a complete implementation of the PlanOut native API framework and a PlanOut language interpreter.

PlanOut.js is implemented in ES6, and can also be used with ES5.

##Installation##

PlanOut.js is available on npm and can be installed by running:

npm install planout

##Comparison with Reference Implementation##

PlanOut.js provides an implementation of all PlanOut features (including the experiment class, interpreter, and namespaces).

##Usage##

Here is how you would use PlanOut.js with ES6:

import PlanOut from 'planout';

class MyExperiment extends PlanOut.Experiment {
	
	configure_logger() {
		return;
		//configure logger
	}

	log(event) {
		//log the event somewhere
	}

	previously_logged() {
		//check if we’ve already logged an event for this user
	}

	setup() {
		//set experiment name, etc.
	}
	
	assign(params, args) {
		params.set('foo', new PlanOut.Ops.Random.UniformChoice({choices: ['a', 'b'], ‘unit’: args.id}));
	}

}

Then, to use this experiment you would simply need to do:

var exp = new MyExperiment({id: user.id });
console.log("User has foo param set to " + exp.get('foo'));

An example of using PlanOut.js with ES5 can be [found here] (https://github.com/facebook/planout/blob/master/alpha/js/examples/sample_planout_es5.js), An example with the PlanOut interpreter can be found here

Development


This project uses Jest for testing. The tests can be found in the tests folder and running the tests simply requires running the command: npm test

Transpile to ES5


If you are making changes to the ES6 implementation, simply run grunt and it will transpile to the corresponding ES5 code.

planout.js's People

Contributors

eytan avatar

Watchers

 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.