• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_ACELITE_JSI_H
17 #define OHOS_ACELITE_JSI_H
18 
19 #include <cstdlib>
20 
21 #include "jsi_types.h"
22 #include "memory_heap.h"
23 
24 /**
25  * Enable JS TypedArray type support.
26  */
27 #ifndef JS_FWK_TYPEDARRAY
28 #define JS_FWK_TYPEDARRAY 1
29 #endif
30 
31 /**
32  * Disable JS Symbol value support.
33  */
34 #ifndef JS_FWK_SYMBOL
35 #define JS_FWK_SYMBOL 0
36 #endif
37 
38 namespace OHOS {
39 namespace ACELite {
40 /**
41  * @brief End flag used in ReleaseValueList(JSIValue value, ...).
42  */
43 static const JSIValue ARGS_END = (JSIValue)(uintptr_t)-1;
44 
45 /**
46  * @brief Function pointer type used to create function callback.
47  *
48  * @param [in] thisVal: the this value provided for the function call
49  * @param [in] args: the function arguments, array of JavaScript values
50  * @param [in] argsNum: the number of arguments
51  */
52 typedef JSIValue (*JSIFunctionHandler)(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum);
53 
54 /**
55  * @brief Description of JerryScript heap memory status.
56  */
57 struct JSHeapStatus : public MemoryHeap {
58     size_t totalBytes;     // heap total size
59     size_t allocBytes;     // currently allocated bytes
60     size_t peakAllocBytes; // peak allocated bytes
61 
62     JSHeapStatus(const JSHeapStatus &) = delete;
63     JSHeapStatus &operator=(const JSHeapStatus &) = delete;
64     JSHeapStatus(JSHeapStatus &&) = delete;
65     JSHeapStatus &operator=(JSHeapStatus &&) = delete;
JSHeapStatusJSHeapStatus66     JSHeapStatus() : totalBytes(0), allocBytes(0), peakAllocBytes(0) {}
67 };
68 
69 /**
70  * @brief Struct definition for JS property descriptor
71  */
72 struct JSPropertyDescriptor : public MemoryHeap {
73     JSIFunctionHandler setter; // access function for setting value
74     JSIFunctionHandler getter; // access function for getting value
75 
JSPropertyDescriptorJSPropertyDescriptor76     JSPropertyDescriptor() : setter(nullptr), getter(nullptr) {}
77 };
78 
79 /**
80  * @brief JavaScriptInterface for adapatation to javascript engines.
81  */
82 class JSI final : public MemoryHeap {
83 public:
84     /**
85      * @brief Get the global javascript object.
86      *
87      * @return the global object acquired
88      * value returned should be released by caller with ReleaseValue when it won't be used any more
89      */
90     static JSIValue GetGlobalObject();
91 
92     /**
93      * @brief Create a javascript object.
94      *
95      * @return the object created
96      * value returned should be released by caller with ReleaseValue when it won't be used any more
97      */
98     static JSIValue CreateObject();
99 
100     /**
101      * @brief Set property to given javascript object.
102      *
103      * @param [in] object: host object to set
104      * @param [in] key: key of the property to set
105      * @param [in] value: value of the property to set
106      */
107     static void SetProperty(JSIValue object, JSIValue key, JSIValue value);
108 
109     /**
110      * @brief Set property to javascript object with given name.
111      *
112      * @param [in] object: host object to set
113      * @param [in] propName: name of the property to set
114      * @param [in] value: value of the property to set
115      */
116     static void SetNamedProperty(JSIValue object, const char * const propName, JSIValue value);
117 
118     /**
119      * @brief Set number property to javascript object with given name.
120      *
121      * @param [in] object: host object to set
122      * @param [in] propName: name of the number property to set
123      * @param [in] value: number value of the property to set
124      */
125     static void SetNumberProperty(JSIValue object, const char * const propName, double value);
126 
127     /**
128      * @brief Set boolean property to javascript object with given name.
129      *
130      * @param [in] object: host object to set
131      * @param [in] propName: name of the boolean property to set
132      * @param [in] value: boolean value of the property to set
133      */
134     static void SetBooleanProperty(JSIValue object, const char * const propName, bool value);
135 
136     /**
137      * @brief Set string property to javascript object with given name.
138      *
139      * @param [in] object: host object to set
140      * @param [in] propName: name of the string property to set
141      * @param [in] value: string value of the property to set
142      */
143     static void SetStringProperty(JSIValue object, const char * const propName, const char *value);
144 
145     /**
146      * @brief Set string property to javascript object with given name.
147      *
148      * @param [in] object: host object to set
149      * @param [in] propName: name of the string property to set
150      * @param [in] value: string value of the property to set
151      * @param [in] size: string size of the property to set
152      */
153     static void
154         SetStringPropertyWithBufferSize(JSIValue object, const char *const propName, const char *value, size_t size);
155 
156     /**
157      * @brief Create javascript function with given native function.
158      *
159      * @param [in] handler: native function pointer
160      * @return javascript function object
161      * value returned should be released by caller with ReleaseValue when it won't be used any more
162      */
163     static JSIValue CreateFunction(JSIFunctionHandler handler);
164 
165     /**
166      * @brief Create javascript string object with character string.
167      *
168      * @param [in] str: string source
169      * @return the string object created
170      * value returned should be released by caller with ReleaseValue when it won't be used any more
171      */
172     static JSIValue CreateString(const char * const str);
173 
174     /**
175      * @brief Create javascript string object with character string.
176      *
177      * @param [in] str: string source
178      * @param [in] size: string length
179      * @return the string object created
180      * value returned should be released by caller with ReleaseValue when it won't be used any more
181      */
182     static JSIValue CreateStringWithBufferSize(const char * const str, size_t size);
183 
184     /**
185      * @brief Create an undefined object.
186      *
187      * @return the undefined object created
188      * value returned should be released by caller with ReleaseValue when it won't be used any more
189      */
190     static JSIValue CreateUndefined();
191 
192     /**
193      * @brief Check if the specified value is a function object value, the value must be created by jerry interface.
194      *
195      * @param [in] value: value to check
196      * @return true: if the given value is a function
197      *         false: otherwise
198      */
199     static bool ValueIsFunction(JSIValue value);
200 
201     /**
202      * @brief Check if the specified value is undefined.
203      *
204      * @param [in] value: value to check
205      * @return true: if the given value is undefined
206      *         false: otherwise
207      */
208     static bool ValueIsUndefined(JSIValue value);
209 
210     /**
211      * @brief Check if the specified value is a number.
212      *
213      * @param [in] value: value to check
214      * @return true: if the given value is a number
215      *         false: otherwise
216      */
217     static bool ValueIsNumber(JSIValue value);
218 
219     /**
220      * @brief Check if the specified value is a string value.
221      *
222      * @param [in] value: value to check
223      * @return true: if the given value is a string value
224      *         false: otherwise
225      */
226     static bool ValueIsString(JSIValue value);
227 
228     /**
229      * @brief Check if the specified value is a boolean value.
230      *
231      * @param [in] value: value to check
232      * @return true: if the given value is a boolean value
233      *         false: otherwise
234      */
235     static bool ValueIsBoolean(JSIValue value);
236 
237     /**
238      * @brief Check if the specified value is a null value.
239      *
240      * @param [in] value: value to check
241      * @return true: if the given value is a null value
242      *         false: otherwise
243      */
244     static bool ValueIsNull(JSIValue value);
245 
246     /**
247      * @brief Check if the specified value is an object value.
248      *
249      * @param [in] value: value to check
250      * @return true: if the given value is an object value
251      *         false: otherwise
252      */
253     static bool ValueIsObject(JSIValue value);
254 
255     /**
256      * @brief Check if the specified value is error value.
257      *
258      * @param [in] value: value to check
259      * @return true: if the given value is error value
260      *         false: otherwise
261      */
262     static bool ValueIsError(JSIValue value);
263 
264     /**
265      * @brief Get the same value as json.stringify().
266      *
267      * @param [in] value: value which can be json stringfied
268      * @return the json string created
269      * value returned should be released with ReleaseString(char *&str) when it won't be used any more
270      */
271     static char *JsonStringify(JSIValue value);
272 
273     /**
274      * @brief Get the same value as json.parse().
275      *
276      * @param [in] str: character string which is in json pattern
277      * @return JSI value created
278      * value returned should be released by caller with ReleaseValue when it won't be used any more
279      */
280     static JSIValue JsonParse(const char * const str);
281 
282     /**
283      * @brief Get value of a property from the specified object with the given key.
284      *
285      * @param [in] object: object value
286      * @param [in] key: property name
287      * @return acquired value of the property
288      * value returned should be released by caller with ReleaseValue when it won't be used any more
289      */
290     static JSIValue GetProperty(JSIValue object, JSIValue key);
291 
292     /**
293      * @brief Get value of a property from the specified object with the given character name.
294      *
295      * @param [in] object: object value
296      * @param [in] propName: property name in character string
297      * @return acquired value of the property
298      * value returned should be released by caller with ReleaseValue when it won't be used any more
299      */
300     static JSIValue GetNamedProperty(JSIValue object, const char * const propName);
301 
302     /**
303      * @brief Get number value from the specified object with the given property name.
304      *
305      * @param [in] object: object value
306      * @param [in] propName: the number property name
307      * @return number value acquired
308      * 0.0 will be returned if the argument passed is not a number object
309      */
310     static double GetNumberProperty(JSIValue object, const char * const propName);
311 
312     /**
313      * @brief Get boolean value from the specified object with the given property name.
314      *
315      * @param [in] object: object value
316      * @param [in] propName: the boolean property name
317      * @return true: if the property value is logical true
318      *         false: otherwise
319      */
320     static bool GetBooleanProperty(JSIValue object, const char * const propName);
321 
322     /**
323      * @brief Get string value from the specified object with the given property name.
324      *
325      * @param [in] object: object value
326      * @param [in] propName: the string property name
327      * @return the string value acquired
328      * value returned should be released with ReleaseString(char *&str) when it won't be used any more
329      */
330     static char *GetStringProperty(JSIValue object, const char * const propName);
331 
332     /**
333      * @brief Get string value from the specified object with the given property name.
334      *
335      * @param [in] object: object value
336      * @param [in] propName: the string property name
337      * @param [out] size: the string property size
338      * @return the string value acquired
339      * value returned should be released with ReleaseString(char *&str) when it won't be used any more
340      */
341     static char *GetStringPropertyWithBufferSize(JSIValue object, const char * const propName, size_t &size);
342 
343     /**
344      * @brief: Release specified API value.
345      *
346      * @param: value JSI value to release
347      */
348     static void ReleaseValue(JSIValue value);
349 
ReleaseValueList()350     static void ReleaseValueList() {}
351 
352     /**
353      * @brief: Release API value list.
354      *
355      * @param: JSI value list to release
356      */
ReleaseValueList(T head,Args...rest)357     template<class T, class... Args> static void ReleaseValueList(T head, Args... rest)
358     {
359         ReleaseValue(head);
360         ReleaseValueList(rest...);
361     }
362 
363     /**
364      * @brief: Release string value.
365      *
366      * @param: str: pointer to the buffer to be released
367      */
368     static void ReleaseString(char *&str);
369 
370     /**
371      * @brief Call javascript function specified by a function value.
372      *
373      * @param [in] funcObj: the function object to call
374      * @param [in] thisVal: object for 'this' binding
375      * @param [in] argv:  function's call arguments
376      * @param [in] argc: number of arguments
377      */
378     static void CallFunction(JSIValue funcObj, JSIValue thisVal, const JSIValue *argv, uint8_t argc);
379 
380     /**
381      * @brief Create javascript number value.
382      *
383      * @param [in] value: source number
384      * @return the number value created
385      * value returned should be released by caller with ReleaseValue when it won't be used any more
386      */
387     static JSIValue CreateNumber(double value);
388 
389     /**
390      * @brief Create a JSIValue representing a not-a-number value.
391      *
392      * @return a JSIValue representing the not-a-number value
393      * value returned should be released by caller with ReleaseValue when it won't be used any more
394      */
395     static JSIValue CreateNumberNaN();
396 
397     /**
398      * @brief Create javascript error object.
399      *
400      * @param [in] type: error type
401      * @param [in] errorMsg: value of 'message' property of constructed error object
402      * @return value of the constructed error object
403      * value returned should be released by caller with ReleaseValue when it won't be used any more
404      */
405     static JSIValue CreateError(JsiErrorType type, const char * const errorMsg);
406 
407     /**
408      * @brief Get the type of the error object.
409      *
410      * @param [in] errorValue: error value to get
411      * @return the type of the error object
412      */
413     static JsiErrorType GetErrorType(JSIValue errorValue);
414 
415     /**
416      * @brief Create javascript boolean value.
417      *
418      * @param [in] value: bool value
419      * @return the boolean value created
420      * value returned should be released by caller with ReleaseValue when it won't be used any more
421      */
422     static JSIValue CreateBoolean(bool value);
423 
424     /**
425      * @brief Create javascript null object.
426      *
427      * @return the null object created
428      * value returned should be released by caller with ReleaseValue when it won't be used any more
429      */
430     static JSIValue CreateNull();
431 
432 #if (JS_FWK_SYMBOL == 1)
433     /**
434      * @brief Create a javascript symbol.
435      *
436      * @param [in] description: source value
437      * @return the symbol object created
438      * value returned should be released by caller with ReleaseValue when it won't be used any more
439      */
440     static JSIValue CreateSymbol(JSIValue description);
441 
442     /**
443      * @brief Check if the specified value is a symbol value.
444      *
445      * @param [in] value: value to check
446      * @return true: if the given value is a symbol value
447      *         false: otherwise
448      */
449     static bool ValueIsSymbol(JSIValue value);
450 #endif // JS_FWK_SYMBOL
451 
452     /**
453      * @brief Create a javascript array.
454      *
455      * @param [in] length: array length
456      * @return the array object created
457      * value returned should be released by caller with ReleaseValue when it won't be used any more
458      */
459     static JSIValue CreateArray(uint32_t length);
460 
461     /**
462      * @brief Set indexed value in the specified javascript object.
463      *
464      * @param [in] object: object to set
465      * @param [in] index: index number
466      * @param [in] value: value to set
467      * @return true: if the operation succeed
468      *         false: otherwise
469      */
470     static bool SetPropertyByIndex(JSIValue object, uint32_t index, JSIValue value);
471 
472     /**
473      * @brief Get the string value of the given JSIValue object.
474      *
475      * @param [in] value: source value
476      * @return the string value created
477      * value returned should be released with ReleaseString(char *&str) when it won't be used any more
478      */
479     static char *ValueToString(JSIValue value);
480 
481     /**
482      * @brief Get the string value of the given JSIValue object.
483      *
484      * @param [in] value: source value
485      * @param [out] size: source size
486      * @return the string value created
487      * value returned should be released with ReleaseString(char *&str) when it won't be used any more
488      */
489     static char *ValueToStringWithBufferSize(JSIValue value, size_t &size);
490 
491     /**
492      * @brief Get the number value of the given JSIValue object.
493      *
494      * @param [in] value: source value
495      * @return double value acquired
496      * 0.0 will be returned if the argument passed is not a number object
497      */
498     static double ValueToNumber(JSIValue value);
499 
500     /**
501      * @brief Get the boolean value of the given JSIValue object.
502      *
503      * @param [in] value: source value
504      * @return true: if the given value is logical true
505      *         false: otherwise
506      */
507     static bool ValueToBoolean(JSIValue value);
508 
509     /**
510      * @brief Check if the specified value is an array object.
511      *
512      * @param [in] value: array value
513      * @return array length acquired
514      * 0 will be returned if the argument passed is not an array object
515      */
516     static uint32_t GetArrayLength(JSIValue value);
517 
518     /**
519      * @brief Get indexed value from the javascript array object.
520      *
521      * @param [in] object: source array object
522      * @param [in] index: index number
523      * @return value acquired from the specified index of the array
524      * value returned should be released by caller with ReleaseValue when it won't be used any more
525      */
526     static JSIValue GetPropertyByIndex(JSIValue object, uint32_t index);
527 
528     /**
529      * @brief Get keys of the specified object value.
530      *
531      * @param [in] object: object value
532      * @return array object of the given object keys
533      * value returned should be released by caller with ReleaseValue when it won't be used any more
534      */
535     static JSIValue GetObjectKeys(JSIValue object);
536 
537     /**
538      * @brief Get heap memory status.
539      *
540      * @param [out] heapStatus: struct for heap memory status acquired
541      * @return true: if the operation succeed
542      *         false: otherwise
543      */
544     static bool GetJSHeapStatus(JSHeapStatus &heapStatus);
545 
546     /**
547      * @brief Check if the specified value is an array object.
548      *
549      * @param [in] value: value to check
550      * @return true: if the given value is an array object
551      *         false: otherwise
552      */
553     static bool ValueIsArray(JSIValue value);
554 
555     /**
556      * @brief Acquire the specified JSI value to create a reference
557      *
558      * @param [in] value: JSI value to acquire
559      * @return acquired value that may be used outside of the engine
560      * value returned should be released by caller with ReleaseValue when it won't be used any more
561      */
562     static JSIValue AcquireValue(JSIValue value);
563 
564     /**
565      * @brief Set API for given exports object
566      *
567      * @param [in] exports: object to set
568      * @param [in] name: API name
569      * @param [in] handler: pointer to the native implementation of this JS API
570      */
571     static void SetModuleAPI(JSIValue exports, const char * const name, JSIFunctionHandler handler);
572 
573     /**
574      * @brief Set JS page destroy callback on given module object
575      *
576      * @param [in] object: JS module object
577      * @param [in] callback: native destroy callback
578      * Note: this function is deprecated, use the other one alternatively
579      */
580     static void SetOnDestroy(JSIValue object, NativeCallback callback);
581 
582     /**
583      * @brief set JS page destroy callback on given module object
584      *
585      * @param [in] object: JS module object
586      * @param [in] callback: native destroy callback
587      */
588     static void SetOnDestroy(JSIValue object, JsiCallback callback);
589 
590     /**
591      * @brief set JS ability terminate callback on given module object
592      *
593      * @param [in] object: JS module object
594      * @param [in] callback: native terminate callback
595      * Note: this function is deprecated, use the other one alternatively
596      */
597     static void SetOnTerminate(JSIValue object, NativeCallback callback);
598 
599     /**
600      * @brief set JS ability terminate callback on given module object
601      *
602      * @param [in] object: JS module object
603      * @param [in] callback: native terminate callback
604      */
605     static void SetOnTerminate(JSIValue object, JsiCallback callback);
606 
607 #if (JS_FWK_TYPEDARRAY == 1)
608     /**
609      * @brief Get the properties of the given javascript TypedArray object.
610      *
611      * @param [in] typedArray: TypedArray object
612      * @param [out] type: type of the TypedArray, one of the TypedArrayType enum value
613      * @param [out] length: the element number of the TypedArray
614      * 0 if the typedArray parameter is not a TypedArray object
615      * @param [out] arrayBuffer: the ArrayBuffer object used by the TypedArray object
616      * value should be released by caller with ReleaseValue when it won't be used any more
617      * @param [out] byteOffset: the start offset of the ArrayBuffer for the TypedArray
618      * @return pointer to the Array Buffer's data area
619      * must ensure that the output pointer is used correctly, that is there is no out of bounds reads or writes
620      * the lifetime of the underlying data buffer is managed by the ArrayBuffer value, thus, do not release the
621      * pointer returned
622      */
623     static uint8_t *GetTypedArrayInfo(JSIValue typedArray,
624                                       TypedArrayType &type,
625                                       size_t &length,
626                                       JSIValue &arrayBuffer,
627                                       size_t &byteOffset);
628 
629     /**
630      * @brief Create a TypedArray object using an already existing ArrayBuffer object.
631      *
632      * @param [in] type: type of the TypedArray, one of the TypedArrayType enum value
633      * @param [in] length: the element number of the TypedArray
634      * @param [in] arrayBuffer: the ArrayBuffer object to use for the new TypedArray
635      * @param [in] byteOffset: the start offset of the ArrayBuffer for the TypedArray
636      * @return the TypedArray object created
637      * value returned should be released by caller with ReleaseValue when it won't be used any more.
638      */
639     static JSIValue CreateTypedArray(TypedArrayType type, size_t length, JSIValue arrayBuffer, size_t byteOffset);
640 
641     /**
642      * @brief Get the properties of the given ArrayBuffer object.
643      *
644      * @param [in] arrayBuffer: ArrayBuffer object
645      * @param [out] byteLength size of the ArrayBuffer in bytes
646      * 0 if the arrayBuffer parameter is not an ArrayBuffer object
647      * @return pointer to the Array Buffer's data area
648      * must ensure that the output pointer is used correctly, that is there is no out of bounds reads or writes
649      * the lifetime of the underlying data buffer is managed by the ArrayBuffer value, thus, do not release the
650      * pointer returned
651      */
652     static uint8_t *GetArrayBufferInfo(JSIValue arrayBuffer, size_t &byteLength);
653 
654     /**
655      * @brief Create an ArrayBuffer object.
656      *
657      * @param [in] byteLength: size of the ArrayBuffer to create in bytes
658      * @param [out] buffPtr: pointer to the Array Buffer's data area
659      * must ensure that the output pointer is used correctly, that is there is no out of bounds reads or writes
660      * the lifetime of the underlying data buffer is managed by the ArrayBuffer value, thus, do not release the pointer
661      * @return the ArrayBuffer object created
662      * result should be released by caller with ReleaseValue when it won't be used any more
663      */
664     static JSIValue CreateArrayBuffer(size_t byteLength, uint8_t *&buffPtr);
665 
666     /**
667      * @brief Check if the specified value is an ArrayBuffer object.
668      *
669      * @param [in] value: value to check
670      * @return true: if the given value is an ArrayBuffer object
671      *         false: otherwise
672      */
673     static bool ValueIsArrayBuffer(JSIValue value);
674 
675     /**
676      * @brief Check if the specified value is a TypedArray object.
677      *
678      * @param [in] value: value to check
679      * @return true: if the given value is an TypedArray object
680      *         false: otherwise
681      */
682     static bool ValueIsTypedArray(JSIValue value);
683 #endif // JS_FWK_TYPEDARRAY
684 
685     /**
686      * @brief Define a property on the specified object with the given name.
687      *
688      * @param [in] object: object to define property on
689      * @param [in] propName: property name
690      * @param [in] descriptor: property descriptor
691      * @return true: if success
692      *         false: otherwise
693      */
694     static bool DefineProperty(JSIValue object, JSIValue propName, JSPropertyDescriptor descriptor);
695 
696     /**
697      * @brief Define a property on the specified object with the given character name.
698      *
699      * @param [in] object: object to define property on
700      * @param [in] propNameStr: property name in character string
701      * @param [in] descriptor: property descriptor
702      * @return true: if success
703      *         false: otherwise
704      */
705     static bool DefineNamedProperty(JSIValue object, const char * const propNameStr, JSPropertyDescriptor descriptor);
706 
707     /**
708      * @brief Define a property on the specified object with the given setter and getter.
709      *
710      * @param [in] object: object to define property on
711      * @param [in] propNameStr: property name in character string
712      * @param [in] setter: access function for setting value
713      * @param [in] getter: access function for getting value
714      * @return true: if success
715      *         false: otherwise
716      */
717     static bool DefineNamedProperty(JSIValue object,
718                                     const char * const propNameStr,
719                                     JSIFunctionHandler setter,
720                                     JSIFunctionHandler getter);
721 
722     /**
723      * @brief Call fail and complete callbacks acquired from args.
724      *
725      * @param [in] thisVal: object for 'this' binding
726      * @param [in] args: object to acquire function callbacks from
727      * @param [in] errCode: error code for fail callback
728      * @param [in] errDesc: error description for fail callback
729      */
730     static void FailCallback(const JSIValue thisVal, const JSIValue args, int32_t errCode, const char * const errDesc);
731 
732     /**
733      * @brief Call success and complete callbacks acquired from args.
734      *
735      * @param [in] thisVal: object for 'this' binding
736      * @param [in] args: object to acquire function callbacks from
737      * @param [in] argv: arguments for success callback
738      * @param [in] argc: number of arguments for success callback
739      */
740     static void SuccessCallback(const JSIValue thisVal, const JSIValue args, const JSIValue *argv, uint8_t argc);
741 
742 private:
743     // private constructor for singleton instance
JSI()744     JSI() {}
~JSI()745     ~JSI() {}
746     static void SetNamedPointer(JSIValue object, const char * const name, JsiCallback callback);
747 };
748 } // namespace ACELite
749 } // namespace OHOS
750 
751 #endif // OHOS_ACELITE_JSI_H
752