Skip to content

cacheString - global #49

Open
Open
@vincent-ogury

Description

@vincent-ogury

Having cacheString in global make unexpected behavior.

Example:

const {ConsentString} = require('consent-string');

const globalVendorList = {vendorListVersion: 1,
  purposes: [{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}],
  vendors: [{id: 10, name: 'vendor1'}, {id: 20, name: 'vendor2'}]};

const test1 = new ConsentString();
test1.setGlobalVendorList(globalVendorList);
test1.setCmpId(7);

const test2 = new ConsentString();
test2.setGlobalVendorList(globalVendorList);
test2.setCmpId(45);

console.log('TEST1:', test1.getConsentString(false));
console.log('TEST2:', test2.getConsentString(false));
console.log(test1.getConsentString(false) === test2.getConsentString(false))
;

In that case the consentString of the first object is returned on the second object!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions