-
Notifications
You must be signed in to change notification settings - Fork 41
Update all commands to rely solely on callbacks #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update all commands to rely solely on callbacks #55
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments :-)
@@ -234,32 +228,25 @@ The `addEventListener` command can be used to define a callback function (or a p | |||
<tr> | |||
<td><code>callback</code></td> | |||
<td>function</td> | |||
<td>function (data: EventListener)</td> | |||
<td>function (data: <a href="https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/main/Core/CMP%20API%20Specification.md#eventlistener-">EventListener</a>, success: boolean)</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do i get there? the callback for the event or the callback for the eventlistener object? what doess sucess do? (why give success = false if there is still an eventListener Object in the callback)?
proposal:
- use callback as a callback (always). in this case, the callback would return immediatly after registering the eventListerner and gives the eventListener Object (so i can unregister it)
- use parameter as the function that should be called when the event happens. the function will (also) get the eventLister Object (but filled with context data about the event)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I fully understand your comment here...
The callback returns the EventListener object as defined just below this section. I'm not sure what you mean by the callback fro the event vs the callback for the eventlistener object.
I've added success to the callbacks to align with both the TCF spec and the sample stub code in this GPP spec. For this command, success would be false if the CMP failed to register the listener for any reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After re-reading your comment, I think we're on the same page. The only change here is that instead of directly returning immediately, the callback would be used for that initial response. The callback would, of course, also continue to be used when future events are triggered. I have added more descriptive text to the text above this table
@@ -166,6 +160,12 @@ supportedAPIs : Array of string, // list of supported APIs (prefix strings), e.g | |||
|
|||
cmpId : Number, // IAB assigned CMP ID, may be 0 during stub/loading | |||
|
|||
sectionList : Array of Number, // may be empty during loading of the CMP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this say array of integer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we are using "Number" elsewere, it makes sence to keep it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hoping to avoid inflating this PR any bigger than it already is. Jan mentioned that Number is used in other parts of this document. I'd prefer to use Number here to be consistent. If we want to update all "Number"s that should be "Integer"s, I think that should be handled in a separate issue/pull request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, the string specification documents say integer though
Core/CMP API Specification.md
Outdated
@@ -166,6 +160,12 @@ supportedAPIs : Array of string, // list of supported APIs (prefix strings), e.g | |||
|
|||
cmpId : Number, // IAB assigned CMP ID, may be 0 during stub/loading | |||
|
|||
sectionList : Array of Number, // may be empty during loading of the CMP | |||
|
|||
applicableSections: Array of Number, // Section ID considered to be in force for this transaction. In most cases, this field should have a single section ID. In rare occasions where such a single section ID can not be determined, the field may contain up to 2 values. The value can be 0 or a Section ID specified by the Publisher / Advertiser, during stub / load. When no section is applicable, the value will be -1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be array of integer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jan and I would prefer to leave it as Number for this PR to be consistent with the rest of the documentation. If it is decided that this and other parts of the document should be changed to Integer, I feel that should be addressed in a separate issue/PR
…ple places that were showing integer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two tiny changes please ;-)
Core/CMP API Specification.md
Outdated
@@ -871,7 +773,7 @@ window.__gpp_stub = function () | |||
if (cmd === 'ping') | |||
{ | |||
return { | |||
gppVersion : '1.0', // must be “Version.Subversion”, current: “1.0” | |||
gppVersion : '1.1', // must be “Version.Subversion”, current: “1.1” |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 3 "new" properties (sectionList, applicableSections, gppString) need to be added to ping, addEventListener and removeEventlisterner:
sectionList:[],
applicableSections:[-1], //or 0 or ID set by publisher
gppString:''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Core/CMP API Specification.md
Outdated
@@ -1042,7 +926,7 @@ The sent message shall follow the form outlined below. The command, parameter an | |||
__gppCall: { | |||
command: "command", | |||
parameter: “parameter”, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you correct the " ? we have three different quotes here (normal, cursive and single quotes) - lets stick to one ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
…tListener, and removeEventListener callbacks in example stub code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-)
@nealrosen can you please also update the description of applicableSections to the following -- This addresses Issue #21. |
… Sectionlist unclear
@lamrowena I have updated the applicableSections description. I see there are now conflict between the PR and the develop branch. At least part of the conflict is due to a recent commit made by HeinzBaumann. I think we should review the conflicts on today's call to determine how to resolve them. |
Resolves issues #23, #51, and #52
Changes in this PR include