Skip to content

Commit

Permalink
feat: Call initialize w/ SDK version first
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacivita committed Aug 21, 2023
1 parent e59d461 commit fc72fc1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions languages/javascript/src/shared/Transport/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ let moduleInstance = null
const isEventSuccess = x => x && (typeof x.event === 'string') && (typeof x.listening === 'boolean')

const win = typeof window !== 'undefined' ? window : {}
let version

export function initialize(v) {
version = v
}

export default class Transport {
constructor () {
Expand Down Expand Up @@ -147,6 +152,12 @@ export default class Transport {

_processRequest (module, method, params, transforms) {

if (version) {
const v = version
version = null
Transport.send("Internal", "initialize", { version: v })
}

const p = this._addPromiseToQueue(module, method, params, transforms)
const json = this._createRequestJSON(module, method, params)

Expand Down
3 changes: 3 additions & 0 deletions src/macrofier/engine.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ const insertAggregateMacros = (fContents = '', aggregateMacros = {}) => {
fContents = fContents.replace(/[ \t]*\/\* \$\{MOCK_OBJECTS\} \*\/[ \t]*\n/, aggregateMacros.mockObjects)
fContents = fContents.replace(/\$\{readable\}/g, aggregateMacros.version.readable)
fContents = fContents.replace(/\$\{package.name\}/g, aggregateMacros.library)
fContents = fContents.replace(/\$\{major\}/g, aggregateMacros.version.major)
fContents = fContents.replace(/\$\{minor\}/g, aggregateMacros.version.minor)
fContents = fContents.replace(/\$\{patch\}/g, aggregateMacros.version.patch)

return fContents
}
Expand Down

0 comments on commit fc72fc1

Please sign in to comment.