From f6d8f78e3fbffbe49fdf4abca952b66bd1dae98a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 20 Oct 2020 16:52:28 +0200 Subject: [PATCH] Hide the private API of the NodeJS integration Hide it behind a `private_api` property in the module export. --- api/sixtyfps-node/lib/index.ts | 6 ++++-- tests/cases/property_animation.60 | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/api/sixtyfps-node/lib/index.ts b/api/sixtyfps-node/lib/index.ts index fcd5394d3..68b5ca26d 100644 --- a/api/sixtyfps-node/lib/index.ts +++ b/api/sixtyfps-node/lib/index.ts @@ -119,6 +119,8 @@ class ArrayModel { } } -native.ArrayModel = ArrayModel; -module.exports = native; +module.exports = { + private_api: native, + ArrayModel: ArrayModel +}; diff --git a/tests/cases/property_animation.60 b/tests/cases/property_animation.60 index a32b2b2ab..05e703bb6 100644 --- a/tests/cases/property_animation.60 +++ b/tests/cases/property_animation.60 @@ -110,14 +110,14 @@ assert.equal(instance.hello, 40); assert.equal(instance.binding_dep, 100); // Half the animation -sixtyfpslib.mock_elapsed_time(600); +sixtyfpslib.private_api.mock_elapsed_time(600); assert.equal(instance.hello, 50); assert.equal(instance.binding_dep, 125); // Remaining half -sixtyfpslib.mock_elapsed_time(600); +sixtyfpslib.private_api.mock_elapsed_time(600); assert.equal(instance.hello, 60); assert.equal(instance.binding_dep, 150); -sixtyfpslib.mock_elapsed_time(100); +sixtyfpslib.private_api.mock_elapsed_time(100); assert.equal(instance.hello, 60); assert.equal(instance.binding_dep, 150); @@ -125,7 +125,7 @@ assert.equal(instance.binding_dep, 150); // querying the value (because te dirty event should cause the animation to start) instance.condition = true; instance.hello = 30; -sixtyfpslib.mock_elapsed_time(600); +sixtyfpslib.private_api.mock_elapsed_time(600); assert.equal(instance.hello, 45); assert.equal(instance.binding_dep, 125);