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":[]}