Comparing version 0.17.0 to 0.17.1
@@ -5,2 +5,10 @@ # Changelog | ||
## 0.17.1 - 2021-01-12 | ||
### Changed | ||
* The `fonts` parameter in `WebMscore.load` can now be passed as type of `Promisable<Uint8Array[]>`. | ||
This allows webmscore to initiate fonts and wasm assets simultaneously. | ||
## 0.17.0 - 2021-01-12 | ||
@@ -7,0 +15,0 @@ |
{ | ||
"name": "webmscore", | ||
"version": "0.17.0", | ||
"version": "0.17.1", | ||
"description": "MuseScore's libmscore in WebAssembly! Read mscz data, and generate audio/MIDI/MusicXML/SVG/PNG/PDF sheets right in browsers", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -42,6 +42,6 @@ export default WebMscore; | ||
* @param {Uint8Array} data | ||
* @param {Uint8Array[]} fonts load extra font files (CJK characters support) | ||
* @param {Uint8Array[] | Promise<Uint8Array[]>} fonts load extra font files (CJK characters support) | ||
* @param {boolean} doLayout set to false if you only need the score metadata or the midi file (Super Fast, 3x faster than the musescore software) | ||
*/ | ||
static load(format: "mscz" | "mscx", data: Uint8Array, fonts?: Uint8Array[], doLayout?: boolean): Promise<WebMscore>; | ||
static load(format: "mscz" | "mscx", data: Uint8Array, fonts?: Uint8Array[] | Promise<Uint8Array[]>, doLayout?: boolean): Promise<WebMscore>; | ||
/** | ||
@@ -48,0 +48,0 @@ * Load (CJK) fonts on demand |
@@ -76,9 +76,12 @@ | ||
* @param {Uint8Array} data | ||
* @param {Uint8Array[]} fonts load extra font files (CJK characters support) | ||
* @param {Uint8Array[] | Promise<Uint8Array[]>} fonts load extra font files (CJK characters support) | ||
* @param {boolean} doLayout set to false if you only need the score metadata or the midi file (Super Fast, 3x faster than the musescore software) | ||
*/ | ||
static async load(format, data, fonts = [], doLayout = true) { | ||
await WebMscore.ready | ||
const [_fonts] = await Promise.all([ | ||
fonts, | ||
WebMscore.ready | ||
]) | ||
for (const f of fonts) { | ||
for (const f of _fonts) { | ||
await WebMscore.addFont(f) | ||
@@ -85,0 +88,0 @@ } |
@@ -72,3 +72,3 @@ // @ts-check | ||
* @param {Uint8Array} data | ||
* @param {Uint8Array[]} fonts load extra font files (CJK characters support) | ||
* @param {Uint8Array[] | Promise<Uint8Array[]>} fonts load extra font files (CJK characters support) | ||
* @param {boolean} doLayout set to false if you only need the score metadata or the midi file (Super Fast, 3x faster than the musescore software) | ||
@@ -78,4 +78,7 @@ */ | ||
const instance = new WebMscoreW() | ||
await instance.rpc('ready') | ||
await instance.rpc('load', [format, data, fonts, doLayout], [data.buffer, ...fonts.map(f => f.buffer)]) | ||
const [_fonts] = await Promise.all([ | ||
fonts, | ||
instance.rpc('ready') | ||
]) | ||
await instance.rpc('load', [format, data, _fonts, doLayout], [data.buffer, ..._fonts.map(f => f.buffer)]) | ||
return instance | ||
@@ -82,0 +85,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21741130
13621