Skip to content

Commit c399c15

Browse files
committed
chore: use static method list
- makes script work with CT SDK - removes hack
1 parent c413d0b commit c399c15

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

build/gtm-script.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { exec } from 'child_process';
22
import { readFileSync, writeFileSync } from 'fs';
3-
import Leanplum from '../src/LeanplumInternal';
43

54
const GTM_REPO_PATH = './gtm-tag';
65
const GTM_REPO = '[email protected]:Leanplum/Leanplum-GTM-Tag.git';
@@ -23,9 +22,7 @@ const execSequential = (commands: string[]): Promise<any> =>
2322
)
2423

2524
async function run() {
26-
const allMethods = Object.getOwnPropertyNames(Leanplum.prototype);
27-
// hack: createRequest is the first private method, thus slicing all public ones, removing the constructor (first field)
28-
const publicMethods = allMethods.slice(1, allMethods.indexOf('createRequest'));
25+
const publicMethods = [ "setApiPath", "setEmail", "setNetworkTimeout", "setAppIdForDevelopmentMode", "setAppIdForProductionMode", "setSocketHost", "setDeviceId", "setLocale", "setAppVersion", "setDeviceName", "setDeviceModel", "setRequestBatching", "setSystemName", "setSystemVersion", "setVariables", "setVariantDebugInfoEnabled", "enableRichInAppMessages", "processMessageEvent", "getVariantDebugInfo", "getVariables", "getVariable", "getVariants", "inbox", "addStartResponseHandler", "removeStartResponseHandler", "addVariablesChangedHandler", "removeVariablesChangedHandler", "forceContentUpdate", "useSessionLength", "start", "startFromCache", "stop", "pauseSession", "resumeSession", "pauseState", "resumeState", "getUserId", "setUserId", "setUserAttributes", "track", "trackPurchase", "advanceTo", "isWebPushSupported", "isWebPushSubscribed", "setWebPushOptions", "registerForWebPush", "unregisterFromWebPush", "clearUserContent", "defineAction", "applyQueue", "on", "off", "getFileUrl"];
2926
let [ version ] = await execParallel([
3027
'npm show leanplum-sdk version',
3128
`git clone ${GTM_REPO} ${GTM_REPO_PATH}`

0 commit comments

Comments
 (0)