提交 68ecb051 编写于 作者: lizhongyi_'s avatar lizhongyi_

调整部分示例避免iOS编译失败

上级 326c71dd
import { RequestTask, SyncOptions } from "./interface.uts"; import { RequestTask, SyncOptions, AsyncOptions, SyntaxResult, SyncResult, TestOptions } from "./interface.uts";
import { log } from "./utils.uts"; import { log } from "./utils.uts";
export type AsyncOptions = {
type : string;
success : (res : string) => void;
fail : (res : string) => void;
complete : (res : string) => void;
};
export type {
SyncOptions
} from "./interface.uts";
type SyntaxResult = {
name : string
};
type SyncResult = {
msg : string
}
/** /**
* 导出一个属性 * 导出一个属性
...@@ -115,11 +98,6 @@ export async function testAsyncParam3(id : number, name : string, opts : AsyncOp ...@@ -115,11 +98,6 @@ export async function testAsyncParam3(id : number, name : string, opts : AsyncOp
} }
export type TestOptions = {
name : string;
callback : (res : string) => void;
};
export class Test { export class Test {
id : number; id : number;
name : string; name : string;
......
...@@ -8,4 +8,24 @@ export interface RequestTask { ...@@ -8,4 +8,24 @@ export interface RequestTask {
abort() : RequestTask abort() : RequestTask
onCallback(callback : (res : string) => void) : void onCallback(callback : (res : string) => void) : void
sync(options : SyncOptions) : string sync(options : SyncOptions) : string
} }
\ No newline at end of file
export type AsyncOptions = {
type : string;
success : (res : string) => void;
fail : (res : string) => void;
complete : (res : string) => void;
};
export type SyntaxResult = {
name : string
};
export type SyncResult = {
msg : string
}
export type TestOptions = {
name : string;
callback : (res : string) => void;
};
\ No newline at end of file
...@@ -23,6 +23,7 @@ const int16 = new TInt16Array() ...@@ -23,6 +23,7 @@ const int16 = new TInt16Array()
export function testArrayBuffer() : Result { export function testArrayBuffer() : Result {
return describe("ArrayBuffer", () => { return describe("ArrayBuffer", () => {
// #ifdef APP-ANDROID
//dataview start //dataview start
test('dataview_constructor', () => { test('dataview_constructor', () => {
tDataView.setConstructor() tDataView.setConstructor()
...@@ -725,7 +726,7 @@ export function testArrayBuffer() : Result { ...@@ -725,7 +726,7 @@ export function testArrayBuffer() : Result {
test('uint32_arrayBufferSlice', () => { test('uint32_arrayBufferSlice', () => {
uint32.arrayBufferSlice() uint32.arrayBufferSlice()
}) })
// #endif
//uint32 end //uint32 end
}) })
} }
\ No newline at end of file
...@@ -18,6 +18,7 @@ export class TDataView { ...@@ -18,6 +18,7 @@ export class TDataView {
// this.setUint8(); // this.setUint8();
// this.testMix(); // this.testMix();
} }
// #ifdef APP-ANDROID
setConstructor() { setConstructor() {
let buffer = new ArrayBuffer(16); let buffer = new ArrayBuffer(16);
let dataview = new DataView(buffer); let dataview = new DataView(buffer);
...@@ -327,4 +328,5 @@ class LittleEndian { ...@@ -327,4 +328,5 @@ class LittleEndian {
this.uint8View_[byteOffset + 3] * (1 << 24) this.uint8View_[byteOffset + 3] * (1 << 24)
); );
} }
// #endif
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
export class TFloat32Array { export class TFloat32Array {
test() { test() {
// #ifdef APP-ANDROID
this.testfloat32(); this.testfloat32();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -31,7 +32,9 @@ export class TFloat32Array { ...@@ -31,7 +32,9 @@ export class TFloat32Array {
this.subarray(); this.subarray();
this.values(); this.values();
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif
} }
// #ifdef APP-ANDROID
from(){ from(){
var float32Array= Float32Array.from([1, 2, 3], (v: number, _: number):number => v + v); var float32Array= Float32Array.from([1, 2, 3], (v: number, _: number):number => v + v);
expect(float32Array.toString()).toEqual('2,4,6'); expect(float32Array.toString()).toEqual('2,4,6');
...@@ -285,4 +288,5 @@ export class TFloat32Array { ...@@ -285,4 +288,5 @@ export class TFloat32Array {
let sliced = new Float32Array(res); let sliced = new Float32Array(res);
expect(sliced[1]).toEqual(42); expect(sliced[1]).toEqual(42);
} }
// #endif
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
export class TFloat64Array { export class TFloat64Array {
test() { test() {
// #ifdef APP-ANDROID
this.testfloat64(); this.testfloat64();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -31,8 +32,9 @@ export class TFloat64Array { ...@@ -31,8 +32,9 @@ export class TFloat64Array {
this.subarray(); this.subarray();
this.values(); this.values();
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif
} }
// #ifdef APP-ANDROID
testfloat64() { testfloat64() {
let float32 = new Float64Array(2); let float32 = new Float64Array(2);
float32[0] = 42; float32[0] = 42;
...@@ -276,4 +278,5 @@ export class TFloat64Array { ...@@ -276,4 +278,5 @@ export class TFloat64Array {
let sliced = new Float64Array(res); let sliced = new Float64Array(res);
expect(sliced[0]).toEqual(42); expect(sliced[0]).toEqual(42);
} }
// #endif
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
export class TInt16Array { export class TInt16Array {
test() { test() {
// #ifdef APP-ANDROID
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
this.testCopyWith(); this.testCopyWith();
...@@ -30,9 +31,10 @@ export class TInt16Array { ...@@ -30,9 +31,10 @@ export class TInt16Array {
this.subarray(); this.subarray();
this.values(); this.values();
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif
} }
// #ifdef APP-ANDROID
testConstructor() { testConstructor() {
let buffer = new ArrayBuffer(16); let buffer = new ArrayBuffer(16);
let float32 = new Int16Array(buffer); let float32 = new Int16Array(buffer);
...@@ -250,4 +252,5 @@ export class TInt16Array { ...@@ -250,4 +252,5 @@ export class TInt16Array {
let sliced = new Int16Array(res); let sliced = new Int16Array(res);
expect(sliced[0]).toEqual(42); expect(sliced[0]).toEqual(42);
} }
// #endif
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
export class TInt32Array { export class TInt32Array {
test() { test() {
// #ifdef APP-ANDROID
this.testfloat32(); this.testfloat32();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -31,8 +32,10 @@ export class TInt32Array { ...@@ -31,8 +32,10 @@ export class TInt32Array {
this.subarray(); this.subarray();
this.values(); this.values();
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif
} }
// #ifdef APP-ANDROID
testfloat32() { testfloat32() {
let float32 = new Int32Array(2); let float32 = new Int32Array(2);
float32[0] = 42; float32[0] = 42;
...@@ -266,4 +269,5 @@ export class TInt32Array { ...@@ -266,4 +269,5 @@ export class TInt32Array {
let sliced = new Int32Array(res); let sliced = new Int32Array(res);
expect(sliced[1]).toEqual(42); expect(sliced[1]).toEqual(42);
} }
// #endif
} }
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
export class TInt8Array { export class TInt8Array {
test() { test() {
// #ifdef APP-ANDROID
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
this.testCopyWith(); this.testCopyWith();
...@@ -31,9 +32,10 @@ export class TInt8Array { ...@@ -31,9 +32,10 @@ export class TInt8Array {
this.subarray(); this.subarray();
this.values(); this.values();
this.arrayBufferSlice(); this.arrayBufferSlice();
//#endif
} }
// #ifdef APP-ANDROID
testConstructor() { testConstructor() {
let buffer = new ArrayBuffer(16); let buffer = new ArrayBuffer(16);
let int8View = new Int8Array(buffer); let int8View = new Int8Array(buffer);
...@@ -261,4 +263,5 @@ export class TInt8Array { ...@@ -261,4 +263,5 @@ export class TInt8Array {
let sliced = new Int8Array(res); let sliced = new Int8Array(res);
expect(sliced[0]).toEqual(42); expect(sliced[0]).toEqual(42);
} }
// #endif
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
export class TUint8Array { export class TUint8Array {
test() { test() {
// #ifdef APP-ANDROID
this.testMAX(); this.testMAX();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -31,7 +32,9 @@ export class TUint8Array { ...@@ -31,7 +32,9 @@ export class TUint8Array {
this.subarray(); this.subarray();
this.values(); this.values();
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif
} }
// #ifdef APP-ANDROID
from() { from() {
var s = new Set([1, 2, 3]); var s = new Set([1, 2, 3]);
var unit8 = Uint8Array.from(s); var unit8 = Uint8Array.from(s);
...@@ -264,4 +267,5 @@ export class TUint8Array { ...@@ -264,4 +267,5 @@ export class TUint8Array {
let sliced = new Uint8Array(res); let sliced = new Uint8Array(res);
expect(sliced[0]).toEqual(42); expect(sliced[0]).toEqual(42);
} }
// #endif
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
export class TUint8ClampedArray { export class TUint8ClampedArray {
test() { test() {
// #ifdef APP-ANDROID
this.testMAX(); this.testMAX();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -31,8 +32,10 @@ export class TUint8ClampedArray { ...@@ -31,8 +32,10 @@ export class TUint8ClampedArray {
this.subarray(); this.subarray();
this.values(); this.values();
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif
} }
// #ifdef APP-ANDROID
testMAX() { testMAX() {
let float32 = new Uint8ClampedArray(16); let float32 = new Uint8ClampedArray(16);
float32[0] = 255; float32[0] = 255;
...@@ -259,4 +262,5 @@ export class TUint8ClampedArray { ...@@ -259,4 +262,5 @@ export class TUint8ClampedArray {
let sliced = new Uint8ClampedArray(res); let sliced = new Uint8ClampedArray(res);
expect(sliced[0]).toEqual(42); expect(sliced[0]).toEqual(42);
} }
// #endif
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
export class TUint16Array { export class TUint16Array {
test() { test() {
// #ifdef APP-ANDROID
this.testfloat32(); this.testfloat32();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -31,8 +32,10 @@ export class TUint16Array { ...@@ -31,8 +32,10 @@ export class TUint16Array {
this.subarray(); this.subarray();
this.values(); this.values();
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif
} }
// #ifdef APP-ANDROID
testfloat32() { testfloat32() {
let float32 = new Uint16Array(2); let float32 = new Uint16Array(2);
float32[0] = 42; float32[0] = 42;
...@@ -273,4 +276,6 @@ export class TUint16Array { ...@@ -273,4 +276,6 @@ export class TUint16Array {
let sliced = new Uint16Array(res); let sliced = new Uint16Array(res);
expect(sliced[0]).toEqual(42); expect(sliced[0]).toEqual(42);
} }
// #endif
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
export class TUint32Array { export class TUint32Array {
test() { test() {
// #ifdef APP-ANDROID
this.testfloat32(); this.testfloat32();
this.testConstructor(); this.testConstructor();
this.testSet(); this.testSet();
...@@ -31,8 +32,10 @@ export class TUint32Array { ...@@ -31,8 +32,10 @@ export class TUint32Array {
this.subarray(); this.subarray();
this.values(); this.values();
this.arrayBufferSlice(); this.arrayBufferSlice();
// #endif
} }
// #ifdef APP-ANDROID
testfloat32() { testfloat32() {
let float32 = new Uint32Array(2); let float32 = new Uint32Array(2);
float32[0] = 42; float32[0] = 42;
...@@ -273,4 +276,5 @@ export class TUint32Array { ...@@ -273,4 +276,5 @@ export class TUint32Array {
let sliced = new Uint32Array(res); let sliced = new Uint32Array(res);
expect(sliced[1]).toEqual(42); expect(sliced[1]).toEqual(42);
} }
// #endif
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册