Fabric.js resolveNamespace() Method
Last Updated :
02 Mar, 2021
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" >
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" >
var namespace1 = "fabric.CommonMethods" ;
var namespace2 = "fabric.Collection" ;
console.log(fabric.util.resolveNamespace(namespace1));
console.log(fabric.util.resolveNamespace(namespace2));
</script>
</body>
</html>
|
Output:
{}
{"_objects":[]}
Share your thoughts in the comments
Please Login to comment...