@segment/analytics.js-core
Version:
The hassle-free way to integrate analytics into any web application.
55 lines (41 loc) • 793 B
text/typescript
;
import { InitOptions } from './types';
/*
* Module dependencies.
*/
var Entity = require('./entity');
var bindAll = require('bind-all');
var debug = require('debug')('analytics:group');
var inherit = require('inherits');
/**
* Group defaults
*/
Group.defaults = {
persist: true,
cookie: {
key: 'ajs_group_id'
},
localStorage: {
key: 'ajs_group_properties'
}
};
/**
* Initialize a new `Group` with `options`.
*/
function Group(options?: InitOptions) {
this.defaults = Group.defaults;
this.debug = debug;
Entity.call(this, options);
}
/**
* Inherit `Entity`
*/
inherit(Group, Entity);
/**
* Expose the group singleton.
*/
module.exports = bindAll(new Group());
/**
* Expose the `Group` constructor.
*/
module.exports.Group = Group;