@leanbase-giangnd/js 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/leanbase.iife.js +5 -1
- package/dist/leanbase.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/iife.ts +10 -0
- package/src/version.ts +1 -1
package/package.json
CHANGED
package/src/iife.ts
CHANGED
|
@@ -2,6 +2,12 @@ import { Leanbase } from './leanbase'
|
|
|
2
2
|
import type { LeanbaseConfig } from './types'
|
|
3
3
|
import { isArray } from '@posthog/core'
|
|
4
4
|
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
__LEANBASE__?: Leanbase | null
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
type QueuedCall = { fn: keyof typeof api; args: any[] }
|
|
6
12
|
|
|
7
13
|
const api = {
|
|
@@ -10,6 +16,10 @@ const api = {
|
|
|
10
16
|
|
|
11
17
|
init(apiKey: string, options?: LeanbaseConfig) {
|
|
12
18
|
this._instance = new Leanbase(apiKey, options)
|
|
19
|
+
// Expose the instantiated SDK for legacy/global access when running in a browser
|
|
20
|
+
if (typeof window !== 'undefined') {
|
|
21
|
+
window.__LEANBASE__ = this._instance
|
|
22
|
+
}
|
|
13
23
|
const q = this._queue
|
|
14
24
|
this._queue = []
|
|
15
25
|
for (const { fn, args } of q) {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.1.
|
|
1
|
+
export const version = '0.1.2'
|