Verge3D PzLib API — Common

# Common

#### (constant) LIST_NONE :string

Default value used in certain list selector puzzles like "objectList", "groupList", "animationList" and "materialList". Useful for checking for the "nothing selected" case.

##### Type:

- string

#### generateUniqueName(name, isUniqueCb) → {string}

Obtain a unique name from the given one by testing it with the given callback function. The given "name", then "name2", "name3", "name4", ... "nameN" are all tried one by one against the "isUniqueCb" function until it returns "true". Then that name is considered unique and returned.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | Base name.
`isUniqueCb` | uniqueNameCallback | Callback function to test names for uniqueness.

##### Returns:

The resulting unique name in the form of "nameN" where N = 2,3,4...

Type
  string

#### getSceneAnimFrameRate(scene) → {number}

Get the given scene's animation framerate.

##### Parameters:

Name | Type | Description
--- | --- | ---
`scene` | v3d.Scene | Scene.

##### Returns:

Scene's animation framerate.

Type
  number

#### getSceneByAction(action) → (nullable) {v3d.Scene}

Get a scene that contains the root of the given action.

##### Parameters:

Name | Type | Description
--- | --- | ---
`action` | v3d.AnimationAction | Animation action.

##### Returns:

The scene containing the given action or "null" if no such scene found.

Type
  v3d.Scene

#### isClipNameUsed(name) → {boolean}

Check if the given name of an animation clip is already used by existing animations within the application.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | Animation clip name.

##### Returns:

Check result.

Type
  boolean

#### isStorageAvailable(type) → {boolean}

Check whether the browser's Web Storage is both supported and available.

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | string | Storage type. Can be 'localStorage' or 'sessionStorage'.

See:
  - https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API

##### Returns:

Check result.

Type
  boolean

#### uniqueNameCallback(name) → {boolean}

A function to determine if the given name is unique (should return "true") or not (should return "false").

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | Base name.

##### Returns:

"true" if the name is considered unique, "false" if not.

Type
  boolean