-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
667 lines (615 loc) · 21.1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
import scriptLoader from './loadscript'
const URL_SCRIPT = "//api.bitrix24.com/api/v1/"
let initialized = false
let throwEnable = true
/**
* Throw mode: Throw an exception when function return result with error
* @param {Boolean} enable
* @returns {boolean}
*/
export const throwOn = (enable) => throwEnable = !!enable;
/**
* @param {ajaxResult} result
* @returns {ajaxResult}
* @throws ajaxError
*/
const handlerResult = (mainResult) => {
const results =
Array.isArray(mainResult) && mainResult
|| mainResult.constructor.name === 'ajaxResult' && [mainResult]
|| Object.values(mainResult)
for(const result of results) {
const next = result.next
result.next = async function() {
if (this.more())
return handlerResult(await new Promise(resolve => next.call(this, resolve)))
else
return false
}
if(throwEnable && !!result.error()) {
console.error(result.error(), result)
throw result.error()
}
}
return mainResult
}
export const isInit = () => initialized;
if (!window.BX24)
window.BX24 = {}
function load() {
return scriptLoader(URL_SCRIPT)
}
/**
* Initializing script
* @returns {Promise<{}>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/system/init.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/system/init.php}
*/
export async function init() {
await load()
initialized = true
await new Promise(resolve => window.BX24.init(resolve))
}
/**
* ! Use this function after init() or install()
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/system/installFinish.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/system/installFinish.php}
* @see init
* @see install
* @example With init()
* init().then(() => {
* // ...
* installFinish();
* })
* @example With install()
* install().then(() => {
* // ...
* installFinish();
* })
*/
export function installFinish() {
window.BX24.installFinish()
}
/**
* @returns {Promise<installFinish>}
* @see installFinish
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/system/install.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/system/install.php}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/system/installFinish.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/system/installFinish.php}
* @example
* install().then((done) => {
* // Some actions
* done();
* })
*/
export async function install() {
await load()
await new Promise(resolve => window.BX24.install(resolve))
return installFinish
}
/**
* @returns {Promise<Boolean|Object>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/system/getAuth.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/system/getAuth.php}
*/
export async function getAuth() {
await init()
return window.BX24.getAuth()
}
/**
* @returns {Promise<Boolean|Object>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/system/refreshAuth.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/system/refreshAuth.php}
*/
export async function refreshAuth() {
await init()
return await new Promise(resolve => window.BX24.refreshAuth(resolve))
}
/**
* @typedef {Object} ajaxResult
* @property {Function<*>} data the function returning the REST method response as an array, an object or a scalar. Refer to the method descriptions for further information.
* @property {Function<ajaxError?>} error returns the error description if an error occurred, or false otherwise.
* @property {Function<Boolean>} more returns true if there is still data to fetch. Applicable to methods that return data.
* @property {Function<Number>} total returns the total number of data records. Applicable to methods that return data.
* @property {Function<Promise<ajaxResult|Boolean>>} next requests and returns the next data chunk.
*/
/**
* @typedef {Object} ajaxError
* @property {Function} getError
* @property {Function} getStatus
* @property {Function<String>} toString
*/
/**
* @param {String} method
* @param {Object} [params={}]
* @returns {Promise<ajaxResult>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/rest/callMethod.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/rest/callMethod.php}
* @throws {ajaxError}
*/
export async function callMethod(method, params) {
await init()
return handlerResult(await new Promise(resolve => window.BX24.callMethod(method, params, resolve)))
}
/**
* @param {Array|Object} calls
* @param {Boolean} [bHaltOnError=false]
* @returns {Promise<Array<ajaxResult>|Object<ajaxResult>>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/rest/callBatch.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/rest/callBatch.php}
* @throws {ajaxError}
*/
export async function callBatch(calls, bHaltOnError) {
await init()
return handlerResult(await new Promise(resolve => window.BX24.callBatch(calls, resolve, bHaltOnError)))
}
/**
* Import Large Data Batches
* ! Support only methods that have entity "ID", support "filter", "order" and "select"
* @param {String} method
* @param {Object} [params={}]
* @returns {Promise<[Object]>}
* @see EN Taken on the basis of {@link https://training.bitrix24.com/rest_help/rest_sum/start.php}
* @see RU Taken on the basis of {@link https://dev.1c-bitrix.ru/rest_help/rest_sum/start.php}
* @throws {ajaxError}
*/
export async function callMethodAll(method, params) {
await init()
const callParams = {}
for (const key in (params || {}))
callParams[key.toLowerCase()] = params[key]
callParams.filter = callParams.filter || {}
if (Array.isArray(callParams.select) && !(callParams.select.includes('ID') || callParams.select().includes('*')))
callParams.select.push('ID')
callParams.order = callParams.order || {}
callParams.order.ID = 'ASC'
callParams.start = -1
let ID = 0;
const globalResult = []
while (true) {
callParams.filter['>ID'] = ID
const result = (await callMethod(method, callParams)).data()
if (!result.length) break;
for (const rest of result) {
ID = rest.ID
globalResult.push(rest)
}
}
return globalResult
}
/**
* Load all items from list by ajaxResult.next()
* @param {String} method
* @param {Object} [params={}]
* @returns {Promise<Array<Object>>}
* @throws {ajaxError}
*/
export async function callMethodAllChunks(method, params= {}) {
let result = await callMethod(method, params)
const data = result.data()
while (result.more()) {
result = await result.next()
data.push(...result.data())
}
return data
}
/**
* @param {String} event
* @param {String} handler
* @param {Number} [auth_type]
* @returns {Promise<ajaxResult>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/rest/bx24.callbind.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/rest/bx24.callbind.php}
* @throws {ajaxError}
*/
export async function callBind(event, handler, auth_type) {
await init()
return handlerResult(await new Promise(resolve => window.BX24.callBind(event, handler, auth_type, resolve)))
}
/**
* @param {String} event
* @param {String} handler
* @param {Number} [auth_type]
* @returns {Promise<ajaxResult>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/rest/bx24_callunbind.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/rest/bx24_callunbind.php}
* @throws {ajaxError}
*/
export async function callUnbind(event, handler, auth_type) {
await init()
return handlerResult(await new Promise(resolve => window.BX24.callUnbind(event, handler, auth_type, resolve)))
}
export const userOption = {
/**
* @param {String} name
* @param {String} value
* @returns {Promise<void>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/settings/userOption.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/settings/userOption.php}
*/
async set(name, value) {
await init()
return window.BX24.userOption.set(name, value)
},
/**
* @param {String} name
* @returns {Promise<void>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/settings/userOption.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/settings/userOption.php}
*/
async get(name) {
await init()
return window.BX24.userOption.get(name)
}
}
export const appOption = {
/**
* @param {String} name
* @param {String} value
* @returns {Promise<void>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/settings/appOption.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/settings/appOption.php}
*/
async set(name, value) {
if (!(await isAdmin())) throw "User is not admin"
return await new Promise(resolve => window.BX24.appOption.set(name, value, resolve))
},
/**
* @param {String} name
* @returns {Promise<void>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/settings/appOption.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/settings/appOption.php}
*/
async get(name) {
await init()
return window.BX24.appOption.get(name)
}
}
/**
* @typedef {Object} Entity
* @property {Number} id - ID
* @property {String} name - Name
*/
/**
* @returns {Promise<Entity>} User
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/dialog/selectUser.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/dialog/selectUser.php}
*/
export async function selectUser() {
await init()
return await new Promise(resolve => window.BX24.selectUser(resolve))
}
/**
* @returns {Promise<[Entity]>} Users
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/dialog/selectUsers.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/dialog/selectUsers.php}
*/
export async function selectUsers() {
await init()
return await new Promise(resolve => window.BX24.selectUsers(resolve))
}
/**
* @param {Array} [value=[]]
* @returns {Promise<[Entity]>} Accesses
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/dialog/selectAccess.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/dialog/selectAccess.php}
*/
export async function selectAccess(value) {
await init()
return await new Promise(resolve => window.BX24.selectAccess(value || [], resolve))
}
/**
* @param {Object} params
* @param {Array<String>} params.entityType
* @param {Boolean} params.multiple
* @param {Array|Object} params.value
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/dialog/selectCRM.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/dialog/selectCRM.php}
*/
export async function selectCRM(params) {
await init()
return await new Promise(resolve => window.BX24.selectCRM(params, resolve))
}
/**
* @returns {Promise<Boolean>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/isAdmin.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/isAdmin.php}
*/
export async function isAdmin() {
await init()
return window.BX24.isAdmin()
}
/**
* @returns {Promise<String>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/getLang.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/getLang.php}
*/
export async function getLang() {
await init()
return window.BX24.getLang()
}
/**
* @param {Number} width
* @param {Number} height
* @returns {Promise<*>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/resizeWindow.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/resizeWindow.php}
*/
export async function resizeWindow(width, height) {
await init()
return await new Promise(resolve => window.BX24.resizeWindow(width, height, resolve))
}
/**
* @returns {Promise<*>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/fitWindow.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/fitWindow.php}
*/
export async function fitWindow() {
await init()
return await new Promise(resolve => window.BX24.fitWindow(resolve))
}
/**
* @returns {Promise<*>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/reloadWindow.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/reloadWindow.php}
*/
export async function reloadWindow() {
await init()
return await new Promise(resolve => window.BX24.reloadWindow(resolve))
}
/**
* @param {String} title
* @returns {Promise<*>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/setTitle.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/setTitle.php}
*/
export async function setTitle(title) {
await init()
return await new Promise(resolve => window.BX24.setTitle(title, resolve))
}
/**
* @returns {Promise<void>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/ready.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/ready.php}
*/
export async function ready() {
await init()
await new Promise(resolve => window.BX24.ready(resolve))
}
/**
* @returns {Promise<Boolean>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/isReady.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/isReady.php}
*/
export async function isReady() {
await init()
return window.BX24.isReady()
}
/**
* @param {Function} func
* @param {Object} thisObject
* @returns {Promise<Function>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/proxy.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/proxy.php}
*/
export async function proxy(func, thisObject) {
await init()
return window.BX24.proxy(func, thisObject)
}
/**
* @returns {Promise<*>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/closeapplication.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/closeapplication.php}
*/
export async function closeApplication() {
await init()
await new Promise(resolve => window.BX24.closeApplication(resolve))
}
/**
* @returns {Promise<*>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/getDomain.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/getDomain.php}
*/
export async function getDomain() {
await init()
return window.BX24.getDomain()
}
/**
* @param {Object} [parameters={}]
* @returns {Promise<*>} resolve when app will be closed
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/openApplication.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/openApplication.php}
*/
export async function openApplication(parameters) {
await init()
await new Promise(resolve => window.BX24.openApplication(parameters || {}, resolve))
}
/**
* @returns {Promise<Object>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/proxyContext.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/proxyContext.php}
*/
export async function proxyContext() {
await init()
return window.BX24.proxyContext()
}
/**
* @param {Number} scroll
* @returns {Promise<*>} resolve when app will be closed
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/scrollparentwindow.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/scrollparentwindow.php}
*/
export async function scrollParentWindow(scroll) {
await init()
await new Promise(resolve => window.BX24.scrollParentWindow(scroll, resolve))
}
/**
* @param {DOMNode} element
* @param {String} eventName
* @param {Function} func
* @returns {Promise<Object>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/bind.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/bind.php}
*/
export async function bind(element, eventName, func) {
await init()
return window.BX24.bind(element, eventName, func)
}
/**
* @param {DOMNode} element
* @param {String} eventName
* @param {Function} func
* @returns {Promise<Object>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/unbind.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/unbind.php}
*/
export async function unbind(element, eventName, func) {
await init()
return window.BX24.unbind(element, eventName, func)
}
/**
* @returns {Promise<Object>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/getScrollSize.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/getScrollSize.php}
*/
export async function getScrollSize() {
await init()
return window.BX24.getScrollSize()
}
/**
* @param {Array|String} script
* @returns {Promise<*>} resolve when app will be closed
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/loadScript.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/loadScript.php}
*/
export async function loadScript(script) {
await init()
await new Promise(resolve => window.BX24.loadScript(script, resolve))
}
export const im = {
/**
* @param userId
* @param {Boolean} [video=true]
* @returns {Promise<void>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/im_callTo.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/im_callTo.php}
*/
async callTo(userId, video) {
await init()
return window.BX24.im.callTo(userId, video)
},
/**
* @param {String} number
* @returns {Promise<void>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/im_phoneTo.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/im_phoneTo.php}
*/
async phoneTo(number) {
await init()
return window.BX24.im.phoneTo(number)
},
/**
* @param {String} dialogId
* @returns {Promise<void>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/im_openMessenger.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/im_openMessenger.php}
*/
async openMessenger(dialogId) {
await init()
return window.BX24.im.openMessenger(dialogId)
},
/**
* @param {String} dialogId
* @returns {Promise<void>}
* @see EN {@link https://training.bitrix24.com/rest_help/js_library/additional/im_openHistory.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/js_library/additional/im_openHistory.php}
*/
async openHistory(dialogId) {
await init()
return window.BX24.im.openHistory(dialogId)
}
}
export const placement = {
/**
* @returns {Promise<Object>}
* @see EN {@link https://training.bitrix24.com/rest_help/application_embedding/application_embedding/placement_info.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/application_embedding/application_embedding/placement_info.php}
* @see EN {@link https://training.bitrix24.com/rest_help/application_embedding/application_embedding/index.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/application_embedding/application_embedding/index.php}
*/
async info() {
await init()
return window.BX24.placement.info()
},
/**
* @returns {Promise<*>}
* @see EN {@link https://training.bitrix24.com/rest_help/application_embedding/application_embedding/index.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/application_embedding/application_embedding/index.php}
*/
async getInterface() {
await init()
await new Promise(resolve => window.BX24.placement.getInterface(resolve))
},
/**
* @param {String} command
* @param {Object} [parameters={}]
* @returns {Promise<*>}
* @see EN {@link https://training.bitrix24.com/rest_help/application_embedding/application_embedding/index.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/application_embedding/application_embedding/index.php}
*/
async call(command, parameters) {
await init()
await new Promise(resolve => window.BX24.placement.call(command, parameters || {}, resolve))
},
/**
* @param {String} event
* @returns {Promise<*>}
* @see EN {@link https://training.bitrix24.com/rest_help/application_embedding/application_embedding/index.php}
* @see RU {@link https://dev.1c-bitrix.ru/rest_help/application_embedding/application_embedding/index.php}
*/
async bindEvent(event) {
await init()
await new Promise(resolve => window.BX24.placement.bindEvent(event, resolve))
}
}
export default {
isInit,
init,
install,
installFinish,
getAuth,
refreshAuth,
callMethod,
callBatch,
callMethodAll,
callMethodAllChunks,
callBind,
callUnbind,
userOption,
appOption,
selectUser,
selectUsers,
selectAccess,
selectCRM,
isAdmin,
getLang,
resizeWindow,
fitWindow,
reloadWindow,
setTitle,
ready,
isReady,
proxy,
closeApplication,
getDomain,
openApplication,
proxyContext,
scrollParentWindow,
bind,
unbind,
getScrollSize,
loadScript,
im,
placement
}