File

projects/atft/src/lib/object/loader/services/svg-loader.service.ts

Extends

AbstractCacheService

Index

Properties
Methods

Methods

Protected getValue
getValue(key: string)
Inherited from AbstractCacheService
Parameters :
Name Type Optional
key string No
Returns : Promise<ShapePath[]>
Public Async load
load(key: string)
Inherited from AbstractCacheService
Parameters :
Name Type Optional
key string No
Returns : Promise<V>

Properties

Protected cache
Default value : new Map<string, Promise<V>>()
Inherited from AbstractCacheService
import {Injectable} from '@angular/core';
import {ShapePath} from 'three';
import {AbstractCacheService} from './abstract-cache.service';
import {SVGLoader} from '../../../threejs-fork/SVGLoader';


@Injectable()
export class SvgLoaderService extends AbstractCacheService<ShapePath[]> {

  protected getValue(key: string): Promise<ShapePath[]> {
    // console.log('SvgLoaderService.getValue');
    return new Promise((resolve, reject) => {
      const loader = new SVGLoader();
      // @ts-ignore
      loader.load(key, data => {
          resolve(data.paths);
        },
        undefined,
        reject
      );
    });
  }

}

results matching ""

    No results matching ""