@vyr/engine 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/asset/Asset.ts +15 -2
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@vyr/engine","version":"0.0.4","description":"","main":"./src/index.ts","author":"","license":"MIT","dependencies":{"@vyr/locale":"0.0.4","tinycolor2":"1.6.0"},"devDependencies":{"@types/tinycolor2":"1.4.6"},"files":["package.json","src/"]}
1
+ {"name":"@vyr/engine","version":"0.0.6","description":"","main":"./src/index.ts","author":"","license":"MIT","dependencies":{"@vyr/locale":"0.0.6","tinycolor2":"1.6.0"},"devDependencies":{"@types/tinycolor2":"1.4.6"},"files":["package.json","src/"]}
@@ -28,11 +28,24 @@ const privateState = {
28
28
  if (name === undefined) return null
29
29
 
30
30
  return Category.parseName(name.split('?')[0])
31
- }
31
+ },
32
+ baseUrl: null as unknown as string,
32
33
  }
33
34
 
34
35
  class Asset {
35
- static baseUrl = location.origin
36
+ static get baseUrl() {
37
+ if (privateState.baseUrl === null) {
38
+ try {
39
+ privateState.baseUrl = location.origin
40
+ } catch (error) {
41
+ privateState.baseUrl = ''
42
+ }
43
+ }
44
+ return privateState.baseUrl
45
+ }
46
+ static set baseUrl(value: string) {
47
+ privateState.baseUrl = value
48
+ }
36
49
  static graph = new AssetGraph()
37
50
 
38
51
  static fetch(url: string, params?: any) {