@/utils#folderName TypeScript Examples
The following examples show how to use
@/utils#folderName.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModelSettings.ts From pixi-live2d-display with MIT License | 6 votes |
/**
* @param json - The settings JSON object.
* @param json.url - The `url` field must be defined to specify the settings file's URL.
*/
protected constructor(json: JSONObject & { url: string }) {
this.json = json;
let url = (json as any).url;
if (typeof url !== 'string') {
// this is not allowed because it'll typically result in errors, including a
// fatal error - an OOM that crashes the browser while initializing this cubism2 model,
// I'm not kidding!
throw new TypeError('The `url` field in settings JSON must be defined as a string.');
}
this.url = url;
// set default name to folder's name
this.name = folderName(this.url);
}