Skip to content

Commit

Permalink
Release 3.1.0 (#81)
Browse files Browse the repository at this point in the history
## Version 3.1.0 (2019-04-28)
### Fixed
*   Correctly reject hyphenator promises (fix issue#77)
*   performance: reduce file size of Hyphenopoly_Loader.js
*   update devDependencies

### Added
*   feature: get maindir and patterndir from currentScript
  • Loading branch information
mnater committed May 28, 2019
1 parent 2b3da7d commit f2fe5ea
Show file tree
Hide file tree
Showing 47 changed files with 929 additions and 540 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Version History

## Version 3.1.0 (2019-04-28)
### Fixed
* Correctly reject hyphenator promises (issue#77)
* performance: reduce file size of Hyphenopoly_Loader.js
* update devDependencies

### Added
* feature: get maindir and patterndir from currentScript

## Version 3.0.2 (2019-04-28)
### Security
* refactor(Loader): don't use innerHTML
Expand Down
19 changes: 9 additions & 10 deletions Hyphenopoly.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license Hyphenopoly 3.0.2 - client side hyphenation for webbrowsers
* @license Hyphenopoly 3.1.0 - client side hyphenation for webbrowsers
* ©2019 Mathias Nater, Zürich (mathiasnater at gmail dot com)
* https://github.com/mnater/Hyphenopoly
*
Expand All @@ -8,7 +8,6 @@
*/

/* globals asmHyphenEngine, Hyphenopoly */

(function mainWrapper(w) {
"use strict";
const SOFTHYPHEN = String.fromCharCode(173);
Expand Down Expand Up @@ -334,12 +333,12 @@
isChild = isChild || false;
const eLang = getElementLanguage(el, pLang);
/* eslint-disable security/detect-object-injection */
if (H.clientFeat.langs[eLang] === "H9Y") {
if (H.cf.langs[eLang] === "H9Y") {
elements.add(el, eLang, sel);
if (!isChild && C.safeCopy) {
registerOnCopy(el);
}
} else if (!H.clientFeat.langs[eLang]) {
} else if (!H.cf.langs[eLang]) {
H.events.dispatch("error", {
"lvl": "warn",
"msg": "Element with '" + eLang + "' found, but '" + eLang + ".hpb' not loaded. Check language tags!"
Expand Down Expand Up @@ -748,10 +747,10 @@
*/
function calculateHeapSize(targetSize) {
/* eslint-disable no-bitwise */
if (H.clientFeat.wasm) {
if (H.cf.wasm) {
return Math.ceil(targetSize / 65536) * 65536;
}
const exp = Math.ceil(Math.log2(targetSize));
const exp = Math.ceil(Math.log(targetSize) * Math.LOG2E);
if (exp <= 12) {
return 1 << 12;
}
Expand Down Expand Up @@ -896,7 +895,7 @@
*/
function encloseHyphenateFunction(baseData, hyphenateFunc) {
/* eslint-disable no-bitwise */
const heapBuffer = H.clientFeat.wasm
const heapBuffer = H.cf.wasm
? baseData.wasmMemory.buffer
: baseData.heapBuffer;
const wordStore = (new Uint16Array(heapBuffer)).subarray(
Expand Down Expand Up @@ -940,7 +939,7 @@
* @returns {undefined}
*/
function instantiateWasmEngine(lang) {
Promise.all([H.binaries.get(lang), H.binaries.get("hyphenEngine")]).then(
Promise.all([H.bins.get(lang), H.bins.get("hyphenEngine")]).then(
function onAll(binaries) {
const hpbBuf = binaries[0];
const baseData = calculateBaseData(hpbBuf);
Expand Down Expand Up @@ -995,7 +994,7 @@
* @returns {undefined}
*/
function instantiateAsmEngine(lang) {
const hpbBuf = H.binaries.get(lang);
const hpbBuf = H.bins.get(lang);
const baseData = calculateBaseData(hpbBuf);
const specMem = H.specMems.get(lang);
const heapBuffer = (specMem.byteLength >= baseData.hs)
Expand Down Expand Up @@ -1095,7 +1094,7 @@
false
);

H.events.define(
H.events.addListener(
"loadError",
function onLoadError(e) {
if (e.msg !== "wasm") {
Expand Down
Loading

0 comments on commit f2fe5ea

Please sign in to comment.