Skip to content

Commit

Permalink
Merge pull request #15 from TeachMeInc/IHG-24
Browse files Browse the repository at this point in the history
IHG-24 Add Capture Event method to API
  • Loading branch information
jordanranson authored Oct 10, 2024
2 parents cbfb1cf + 525be95 commit fc80565
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions platforms/html5/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export default class SWAGAPI extends Emitter {
return messages.trySendMessage('swag.navigateToTitle', slug);
}

captureEvent (event: string, params: any) {
const payload = JSON.stringify({ event, params });
return messages.trySendMessage('swag.captureEvent', payload);
}

// #endregion


Expand Down
2 changes: 1 addition & 1 deletion platforms/html5/src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const methods = Emitter({
const promise = new Promise<{ day: string }>(function (resolve) {
const urlParams = utils.parseUrlParams();
if (urlParams.day && urlParams.month && urlParams.year) {
var yearPart = parseInt (urlParams.year, 10);
const yearPart = parseInt(urlParams.year, 10);
const dayParts = [
(yearPart > 2000 ? yearPart : 2000 + yearPart), // handle both 4 digit and 2 digit years
padDateDigit(parseInt (urlParams.month, 10)),
Expand Down

0 comments on commit fc80565

Please sign in to comment.