mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 02:42:08 +00:00

Basic support for Dataview is added in this commit. This is achieved by using three functions, napi_create_dataview(), napi_is_dataview() and napi_get_dataview_info(). PR-URL: https://github.com/nodejs/node/pull/14382 Fixes: https://github.com/nodejs/node/issues/13926 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
15 lines
471 B
JavaScript
15 lines
471 B
JavaScript
'use strict';
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
|
|
// Testing api calls for arrays
|
|
const test_dataview = require(`./build/${common.buildType}/test_dataview`);
|
|
|
|
//create dataview
|
|
const buffer = new ArrayBuffer(128);
|
|
const template = Reflect.construct(DataView, [buffer]);
|
|
|
|
const theDataview = test_dataview.CreateDataView(template);
|
|
assert.ok(theDataview instanceof DataView,
|
|
'The new variable should be of type Dataview');
|