{"size": 517, "ext": "js", "max_stars_repo_path": "bikeshed/static/bikeshed/framework/Session.js", "max_stars_repo_name": "emulbreh/bikeshed", "max_stars_repo_stars_event_min_datetime": "2015-03-04T10:12:35.000Z", "max_stars_repo_stars_event_max_datetime": "2017-06-19T04:05:33.000Z", "max_issues_repo_path": "bikeshed/static/bikeshed/framework/Session.js", "max_issues_repo_name": "emulbreh/bikeshed", "max_issues_repo_issues_event_min_datetime": "2020-02-02T22:04:31.000Z", "max_issues_repo_issues_event_max_datetime": "2020-02-02T22:04:31.000Z", "max_forks_repo_path": "bikeshed/static/bikeshed/framework/Session.js", "max_forks_repo_name": "emulbreh/bikeshed", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 22.4782608696, "max_line_length": 63, "alphanum_fraction": 0.5531914894}
import {EventEmitter} from '../../EventEmitter'


export class Session extends EventEmitter{
    constructor(options={}){
        super.constructor();
        _.defaults(options, {
            key: 'bikeshed.session'
        });
        this.key = options.key;
        this.data = JSON.parse(localStorage[this.key] || '{}');
    }
    
    set(name, value){
        this.data[name] = value;
        localStorage[this.key] = JSON.stringify(this.data);
    }
    
    get(name){
        return this.data[name];
    }
}
