This commit is contained in:
2025-04-29 13:26:19 +08:00
parent 6e1ae24845
commit bf88fcb395
73 changed files with 12939 additions and 4637 deletions

File diff suppressed because one or more lines are too long

View File

@@ -5,6 +5,10 @@
* @fileoverview Global |this| required for resolving indexes in node.
* @suppress {globalThis}
*/
import encodingIndexes from './encoding-indexes';
const encodingGlobal = {
'encoding-indexes' : encodingIndexes
};
(function(global) {
'use strict';
@@ -35,6 +39,7 @@
* @return {boolean} True if the item appears in the array.
*/
function includes(array, item) {
console.log(1);
return array.indexOf(item) !== -1;
}
@@ -834,6 +839,7 @@
* |index|, or null if |code point| is not in |index|.
*/
function indexPointerFor(code_point, index) {
console.log(code_point,index);
var pointer = index.indexOf(code_point);
return pointer === -1 ? null : pointer;
}
@@ -935,6 +941,7 @@
var index_ = shift_jis_index;
// 2. Return the index pointer for code point in index.
console.log(3);
return index_.indexOf(code_point);
}
var shift_jis_index;
@@ -3309,4 +3316,5 @@
// For strict environments where `this` inside the global scope
// is `undefined`, take a pure object instead
}(this || {}));
}(encodingGlobal));
export default encodingGlobal

View File

@@ -482,5 +482,4 @@ var jpPrinter = {
}
};
module.exports.jpPrinter = jpPrinter;
export default jpPrinter;

View File

@@ -1,5 +1,8 @@
// var app = getApp();
var encode = require("./encoding.js");
// var encode = require("./encoding.js");
// import encode from './encoding.js'
// const encode = import('./encoding.js')
import * as encode from './encoding.js'
var jpPrinter = {
createNew: function() {
var jpPrinter = {};
@@ -12,13 +15,16 @@ var jpPrinter = {
//将指令转成数组装起
jpPrinter.addCommand = function(content) {
var code = new encode.TextEncoder(
console.log('断点2.4',encode);
var code = new encode.default.TextEncoder(
'gb18030', {
NONSTANDARD_allowLegacyEncoding: true
}).encode(content)
console.log('断点2.5',code);
for (var i = 0; i < code.length; ++i) {
command.push(code[i])
}
console.log('断点2.6');
}
/**
@@ -27,8 +33,11 @@ var jpPrinter = {
* @param {int} pageHeight 标签纸高度单位mm
*/
jpPrinter.setSize = function(pageWidght, pageHeight) {
console.log('断点2.2');
data = "SIZE " + pageWidght.toString() + " mm" + "," + pageHeight.toString() + " mm" + "\r\n";
console.log('断点2.3');
jpPrinter.addCommand(data)
};
/**
@@ -370,4 +379,4 @@ var jpPrinter = {
}
};
module.exports.jpPrinter = jpPrinter;
export default jpPrinter;