| 27 | // @param {string} movieClipUrl - The url of the javascript file. |
| 28 | // @return {Promise<Object>} - The movieclips and metaData returned from the createjs javascript file. |
| 29 | const loadCreateJs = movieClipUrl => fetch(movieClipUrl, { method: 'GET' }) |
| 30 | .then(data => data.text()) |
| 31 | .then(function (movieClipDefinition) { |
| 32 | // There is a method that is deprecated that we need to replace. The method and property are semantically identical |
| 33 | movieClipDefinition = movieClipDefinition.replace(/getNumChildren\(\)/g, 'numChildren') |
| 34 | |
| 35 | const AnimateComposition = {} |
| 36 | // eslint-disable-next-line no-new-func |
| 37 | new Function('createjs', 'AdobeAn', movieClipDefinition)(window.createjs, AnimateComposition) |
| 38 | |
| 39 | if (Object.values(AnimateComposition.compositions).length !== 1) { |
| 40 | throw new Error('There must be one composition per Adobe Animate export') |
| 41 | } |
| 42 | |
| 43 | const comp = Object.values(AnimateComposition.compositions)[0] |
| 44 | const lib = comp.getLibrary() |
| 45 | const ss = comp.getSpriteSheet() |
| 46 | const { ssMetadata } = lib |
| 47 | |
| 48 | return { lib, ss, ssMetadata } |
| 49 | }) |
| 50 | |
| 51 | let buildQueue = [] |
| 52 |
no test coverage detected