Skip to main content

env

Functions

addTest()

env.addTest(name: string, fn: () => boolean): void;

Add a custom feature-detection test where name is a string which uniquely identifies your feature test and fn is a function that returns true if the browser supports the feature, and false if it does not.

import { env } from '@joint/core';

env.addTest('customTest', function() {
// Just as an example, we will always return true here.
return true;
});

if (env.test('customTest')) {
// Feature is supported.
}

test()

env.test(name: string): boolean;

Tests whether the browsers supports the given feature or not. Returns true if the feature is supported, otherwise it returns false.

import { env } from '@joint/core';

if (env.test('someFeature')) {
// Feature is supported.
}

JointJS ships with the following tests:

  • svgforeignobject - Tests whether the browser supports foreignObject.

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub