Skip to content

cacheString - global #49

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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