Fabric.js resolveNamespace() Method

The resolveNamespace() method is used to return object for the specified namespace.
Syntax:
resolveNamespace(namespace)
Parameters: This method accepts a parameter as mentioned above and described below:
- namespace: This parameter holds the specified namespace string, for example ‘fabric.Image.filter’, ‘fabric’ etc.
Return Value: This method returns the object for the specified namespace.
Example 1:
Javascript
<!DOCTYPE html><html><head> <!-- Adding the FabricJS library --> <script src= </script></head><body><script type="text/javascript"> /* Calling resolveNamespace() function over the specified namespace */ console.log(fabric.util.resolveNamespace("fabric.Observable")); console.log(fabric.util.resolveNamespace("fabric.util"));</script></body></html> |
Output:
{}
{"array":{},"object":{},"string":{},"ease":{}}
Example 2:
Javascript
<!DOCTYPE html><html><head> <!-- Adding the FabricJS library --> <script src= </script></head><body><script type="text/javascript"> // Specifying some namespace var namespace1 = "fabric.CommonMethods"; var namespace2 = "fabric.Collection"; /* Calling resolveNamespace() function over the above specified namespace*/ console.log(fabric.util.resolveNamespace(namespace1)); console.log(fabric.util.resolveNamespace(namespace2));</script></body></html> |
Output:
{}
{"_objects":[]}
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!



