Added allocator and deallocator for typed arrays

This commit is contained in:
Mikhail Lobotskiy
2023-11-23 19:13:03 +04:00
parent 3ae6927ac3
commit b0dfb4c731
5 changed files with 26 additions and 20 deletions

View File

@ -80,15 +80,14 @@ int main()
numbers[3] = innerArray;
textPr["numbers"] = numbers;
// create typed array
/*
BYTE* pData = new BYTE[4];
BYTE* pData = CValue::AllocTypedArray(4);
pData[0] = 11;
pData[1] = 23;
pData[2] = 58;
pData[3] = 13;
// add typed array
...
*/
CValue typedArr = CValue::CreateTypedArray(pData, 4, false);
textPr["typedArr"] = typedArr;
// convert to JS
JSSmart<CJSObject> jsObj = toJS(textPr)->toObject();