Fix when print log string which contains special control characters in doric,cause native crash
This commit is contained in:
parent
54ecddf994
commit
fc4628dde9
@ -24,7 +24,6 @@ import java.io.StringWriter;
|
|||||||
|
|
||||||
import pub.doric.DoricContext;
|
import pub.doric.DoricContext;
|
||||||
import pub.doric.IDoricMonitor;
|
import pub.doric.IDoricMonitor;
|
||||||
import pub.doric.utils.DoricLog;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: pub.doric.devkit
|
* @Description: pub.doric.devkit
|
||||||
@ -55,15 +54,12 @@ public class DoricDevMonitor implements IDoricMonitor {
|
|||||||
String typeString = "DEFAULT";
|
String typeString = "DEFAULT";
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Log.ERROR:
|
case Log.ERROR:
|
||||||
DoricLog.suffix_e("_js", message);
|
|
||||||
typeString = "ERROR";
|
typeString = "ERROR";
|
||||||
break;
|
break;
|
||||||
case Log.WARN:
|
case Log.WARN:
|
||||||
DoricLog.suffix_w("_js", message);
|
|
||||||
typeString = "WARN";
|
typeString = "WARN";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DoricLog.suffix_d("_js", message);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DoricDev.getInstance().sendDevCommand(
|
DoricDev.getInstance().sendDevCommand(
|
||||||
|
@ -26,8 +26,6 @@ import android.os.Message;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.github.pengfeizhou.jscore.JSDecoder;
|
import com.github.pengfeizhou.jscore.JSDecoder;
|
||||||
import com.github.pengfeizhou.jscore.JSONBuilder;
|
import com.github.pengfeizhou.jscore.JSONBuilder;
|
||||||
import com.github.pengfeizhou.jscore.JavaFunction;
|
import com.github.pengfeizhou.jscore.JavaFunction;
|
||||||
@ -39,6 +37,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import pub.doric.Doric;
|
import pub.doric.Doric;
|
||||||
import pub.doric.DoricContext;
|
import pub.doric.DoricContext;
|
||||||
import pub.doric.DoricContextManager;
|
import pub.doric.DoricContextManager;
|
||||||
@ -343,13 +342,13 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
|
|||||||
public void onLog(int type, String message) {
|
public void onLog(int type, String message) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Log.ERROR:
|
case Log.ERROR:
|
||||||
DoricLog.suffix_e("_js", "%s", message);
|
DoricLog.suffix_e("_js", message);
|
||||||
break;
|
break;
|
||||||
case Log.WARN:
|
case Log.WARN:
|
||||||
DoricLog.suffix_w("_js", "%s", message);
|
DoricLog.suffix_w("_js", message);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DoricLog.suffix_d("_js", "%s", message);
|
DoricLog.suffix_d("_js", message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,9 @@ public class DoricLog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String format(String message, Object... args) {
|
private static String format(String message, Object... args) {
|
||||||
|
if (args.length > 0) {
|
||||||
return String.format(message, args);
|
return String.format(message, args);
|
||||||
}
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
export default [
|
export default [
|
||||||
'src/Counter',
|
'src/Counter',
|
||||||
'src/Snake',
|
|
||||||
'src/ComplicatedAnimations',
|
|
||||||
'src/.*Demo',
|
|
||||||
'src/Gobang',
|
|
||||||
]
|
]
|
@ -73,29 +73,12 @@ class CounterView extends ViewHolder {
|
|||||||
class CounterVM extends ViewModel<CountModel, CounterView> {
|
class CounterVM extends ViewModel<CountModel, CounterView> {
|
||||||
onAttached(s: CountModel, vh: CounterView) {
|
onAttached(s: CountModel, vh: CounterView) {
|
||||||
vh.counter.onClick = () => {
|
vh.counter.onClick = () => {
|
||||||
setInterval(() => {
|
this.updateState(state => state.count++)
|
||||||
// this.updateState(state => {
|
|
||||||
// state.count++
|
|
||||||
// })
|
|
||||||
this.context.callNative("demo", "test2", "sdfsf")
|
|
||||||
//loge("setInterval")
|
|
||||||
}, 1)
|
|
||||||
};
|
};
|
||||||
vh.number.onClick = () => {
|
|
||||||
setInterval(() => {
|
|
||||||
// this.updateState(state => {
|
|
||||||
// state.count++
|
|
||||||
// })
|
|
||||||
this.context.callNative("demo", "test")
|
|
||||||
}, 1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onBind(s: CountModel, vh: CounterView) {
|
onBind(s: CountModel, vh: CounterView) {
|
||||||
vh.number.text = `${s.count}`;
|
vh.number.text = `${s.count}`;
|
||||||
log(`Current count is ${s.count}`);
|
console.error(` select * from production %d where (title like '%s%' or rawHtml like '%s%') and id > 39 limit 15`)
|
||||||
logw(`Current count is ${s.count}`);
|
|
||||||
loge(`Current count is ${s.count}`);
|
|
||||||
console.log("This is from console.log")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,17 @@ - (void)onException:(NSException *)exception inContext:(DoricContext *)context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)onLog:(DoricLogType)type message:(NSString *)message {
|
- (void)onLog:(DoricLogType)type message:(NSString *)message {
|
||||||
DoricLog(message);
|
switch (type) {
|
||||||
|
case DoricLogTypeWarning:
|
||||||
|
DoricSafeLog([@"Doric-W: " stringByAppendingString:message]);
|
||||||
|
break;
|
||||||
|
case DoricLogTypeError:
|
||||||
|
DoricSafeLog([@"Doric-E: " stringByAppendingString:message]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DoricSafeLog([@"Doric-D: " stringByAppendingString:message]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -335,7 +345,7 @@ - (void)callbackTimer:(NSTimer *)timer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (id)jsValueToObject:(JSValue *)jsValue {
|
- (id)jsValueToObject:(JSValue *)jsValue {
|
||||||
if([jsValue isKindOfClass:NSDictionary.class]){
|
if ([jsValue isKindOfClass:NSDictionary.class]) {
|
||||||
return jsValue;
|
return jsValue;
|
||||||
}
|
}
|
||||||
return [jsValue toObjectWithArrayBuffer];
|
return [jsValue toObjectWithArrayBuffer];
|
||||||
|
@ -27,8 +27,11 @@
|
|||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void DoricLog(NSString *_Nonnull format, ...);
|
void DoricLog(NSString *_Nonnull format, ...);
|
||||||
|
|
||||||
|
void DoricSafeLog(NSString *_Nonnull message);
|
||||||
|
|
||||||
UIColor *_Nonnull DoricColor(NSNumber *_Nonnull number);
|
UIColor *_Nonnull DoricColor(NSNumber *_Nonnull number);
|
||||||
|
|
||||||
NSNumber *_Nonnull DoricColorToNumber(UIColor *_Nonnull color);
|
NSNumber *_Nonnull DoricColorToNumber(UIColor *_Nonnull color);
|
||||||
@ -50,6 +53,7 @@ void ShowToastInVC(UIViewController *_Nonnull vc, NSString *_Nonnull text, Doric
|
|||||||
UIImage *_Nonnull UIImageWithColor(UIColor *_Nonnull color);
|
UIImage *_Nonnull UIImageWithColor(UIColor *_Nonnull color);
|
||||||
|
|
||||||
BOOL hasNotch(void);
|
BOOL hasNotch(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,6 +31,10 @@ void DoricLog(NSString *_Nonnull format, ...) {
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoricSafeLog(NSString *_Nonnull message) {
|
||||||
|
NSLog(@"%@", message);
|
||||||
|
}
|
||||||
|
|
||||||
UIColor *DoricColor(NSNumber *number) {
|
UIColor *DoricColor(NSNumber *number) {
|
||||||
CGFloat r, g, b, a;
|
CGFloat r, g, b, a;
|
||||||
long colorValue = [number longValue];
|
long colorValue = [number longValue];
|
||||||
|
@ -4360,7 +4360,7 @@ var __generator$1 = (undefined && undefined.__generator) || function (thisArg, b
|
|||||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
function step(op) {
|
function step(op) {
|
||||||
if (f) { throw new TypeError("Generator is already executing."); }
|
if (f) { throw new TypeError("Generator is already executing."); }
|
||||||
while (g && (g = 0, op[0] && (_ = 0)), _) { try {
|
while (_) { try {
|
||||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; }
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; }
|
||||||
if (y = 0, t) { op = [op[0] & 2, t.value]; }
|
if (y = 0, t) { op = [op[0] & 2, t.value]; }
|
||||||
switch (op[0]) {
|
switch (op[0]) {
|
||||||
@ -4589,7 +4589,7 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|||||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
function step(op) {
|
function step(op) {
|
||||||
if (f) { throw new TypeError("Generator is already executing."); }
|
if (f) { throw new TypeError("Generator is already executing."); }
|
||||||
while (g && (g = 0, op[0] && (_ = 0)), _) { try {
|
while (_) { try {
|
||||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; }
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; }
|
||||||
if (y = 0, t) { op = [op[0] & 2, t.value]; }
|
if (y = 0, t) { op = [op[0] & 2, t.value]; }
|
||||||
switch (op[0]) {
|
switch (op[0]) {
|
||||||
|
@ -161,24 +161,6 @@ function createRef() {
|
|||||||
return new Ref;
|
return new Ref;
|
||||||
}
|
}
|
||||||
class View {
|
class View {
|
||||||
callback2Id(f) {
|
|
||||||
const id = uniqueId('Function');
|
|
||||||
this.callbacks.set(id, f);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
id2Callback(id) {
|
|
||||||
let f = this.callbacks.get(id);
|
|
||||||
if (f === undefined) {
|
|
||||||
f = Reflect.get(this, id);
|
|
||||||
}
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
findViewByTag(tag) {
|
|
||||||
if (tag === this.tag) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.width = 0;
|
this.width = 0;
|
||||||
this.height = 0;
|
this.height = 0;
|
||||||
@ -210,6 +192,24 @@ class View {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
callback2Id(f) {
|
||||||
|
const id = uniqueId('Function');
|
||||||
|
this.callbacks.set(id, f);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
id2Callback(id) {
|
||||||
|
let f = this.callbacks.get(id);
|
||||||
|
if (f === undefined) {
|
||||||
|
f = Reflect.get(this, id);
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
findViewByTag(tag) {
|
||||||
|
if (tag === this.tag) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
/** Anchor start*/
|
/** Anchor start*/
|
||||||
get left() {
|
get left() {
|
||||||
return this.x;
|
return this.x;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1273,16 +1273,6 @@ var doric = (function (exports) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Context {
|
class Context {
|
||||||
hookBeforeNativeCall() {
|
|
||||||
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
|
||||||
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hookAfterNativeCall() {
|
|
||||||
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
|
||||||
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
this.callbacks = new Map;
|
this.callbacks = new Map;
|
||||||
this.classes = new Map;
|
this.classes = new Map;
|
||||||
@ -1317,6 +1307,16 @@ var doric = (function (exports) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
hookBeforeNativeCall() {
|
||||||
|
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
||||||
|
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hookAfterNativeCall() {
|
||||||
|
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
||||||
|
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
||||||
|
}
|
||||||
|
}
|
||||||
callNative(namespace, method, args) {
|
callNative(namespace, method, args) {
|
||||||
const callbackId = uniqueId('callback');
|
const callbackId = uniqueId('callback');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -1284,16 +1284,6 @@ function jsCallReject(contextId, callbackId, args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Context {
|
class Context {
|
||||||
hookBeforeNativeCall() {
|
|
||||||
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
|
||||||
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hookAfterNativeCall() {
|
|
||||||
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
|
||||||
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
this.callbacks = new Map;
|
this.callbacks = new Map;
|
||||||
this.classes = new Map;
|
this.classes = new Map;
|
||||||
@ -1328,6 +1318,16 @@ class Context {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
hookBeforeNativeCall() {
|
||||||
|
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
||||||
|
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hookAfterNativeCall() {
|
||||||
|
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
||||||
|
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
||||||
|
}
|
||||||
|
}
|
||||||
callNative(namespace, method, args) {
|
callNative(namespace, method, args) {
|
||||||
const callbackId = uniqueId('callback');
|
const callbackId = uniqueId('callback');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -1701,24 +1701,6 @@ function createRef() {
|
|||||||
return new Ref;
|
return new Ref;
|
||||||
}
|
}
|
||||||
class View {
|
class View {
|
||||||
callback2Id(f) {
|
|
||||||
const id = uniqueId('Function');
|
|
||||||
this.callbacks.set(id, f);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
id2Callback(id) {
|
|
||||||
let f = this.callbacks.get(id);
|
|
||||||
if (f === undefined) {
|
|
||||||
f = Reflect.get(this, id);
|
|
||||||
}
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
findViewByTag(tag) {
|
|
||||||
if (tag === this.tag) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.width = 0;
|
this.width = 0;
|
||||||
this.height = 0;
|
this.height = 0;
|
||||||
@ -1750,6 +1732,24 @@ class View {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
callback2Id(f) {
|
||||||
|
const id = uniqueId('Function');
|
||||||
|
this.callbacks.set(id, f);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
id2Callback(id) {
|
||||||
|
let f = this.callbacks.get(id);
|
||||||
|
if (f === undefined) {
|
||||||
|
f = Reflect.get(this, id);
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
findViewByTag(tag) {
|
||||||
|
if (tag === this.tag) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
/** Anchor start*/
|
/** Anchor start*/
|
||||||
get left() {
|
get left() {
|
||||||
return this.x;
|
return this.x;
|
||||||
|
2
doric-js/index.d.ts
vendored
2
doric-js/index.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
declare module "doric" {
|
declare module "doric" {
|
||||||
// Generated by dts-bundle-generator v6.13.0
|
// Generated by dts-bundle-generator v6.12.0
|
||||||
|
|
||||||
export interface Modeling {
|
export interface Modeling {
|
||||||
toModel(): Model;
|
toModel(): Model;
|
||||||
|
4
doric-js/lib/index.web.d.ts
vendored
4
doric-js/lib/index.web.d.ts
vendored
@ -4,8 +4,8 @@ declare module NativeClient {
|
|||||||
function callNative(name: string, args: string): string;
|
function callNative(name: string, args: string): string;
|
||||||
function fetchArrayBuffer(id: string): string;
|
function fetchArrayBuffer(id: string): string;
|
||||||
}
|
}
|
||||||
type RawValue = number | string | boolean | object | undefined | ArrayBuffer;
|
declare type RawValue = number | string | boolean | object | undefined | ArrayBuffer;
|
||||||
type WrappedValue = {
|
declare type WrappedValue = {
|
||||||
type: "number" | "string" | "boolean" | "object" | "array" | "null" | "arrayBuffer";
|
type: "number" | "string" | "boolean" | "object" | "array" | "null" | "arrayBuffer";
|
||||||
value: RawValue;
|
value: RawValue;
|
||||||
};
|
};
|
||||||
|
2
doric-js/lib/src/pattern/mvvm.d.ts
vendored
2
doric-js/lib/src/pattern/mvvm.d.ts
vendored
@ -5,7 +5,7 @@ import { ClassType } from "../util/types";
|
|||||||
export declare abstract class ViewHolder {
|
export declare abstract class ViewHolder {
|
||||||
abstract build(root: Group): void;
|
abstract build(root: Group): void;
|
||||||
}
|
}
|
||||||
export type Setter<M> = (state: M) => void;
|
export declare type Setter<M> = (state: M) => void;
|
||||||
export declare abstract class ViewModel<M extends Object, V extends ViewHolder> {
|
export declare abstract class ViewModel<M extends Object, V extends ViewHolder> {
|
||||||
context: BridgeContext;
|
context: BridgeContext;
|
||||||
private state;
|
private state;
|
||||||
|
4
doric-js/lib/src/pattern/provider.d.ts
vendored
4
doric-js/lib/src/pattern/provider.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
export type Observer<T> = (v: T) => void;
|
export declare type Observer<T> = (v: T) => void;
|
||||||
export type Updater<T> = (v: T) => T;
|
export declare type Updater<T> = (v: T) => T;
|
||||||
export interface IObservable<T> {
|
export interface IObservable<T> {
|
||||||
addObserver(observer: Observer<T | undefined>): void;
|
addObserver(observer: Observer<T | undefined>): void;
|
||||||
removeObserver(observer: Observer<T | undefined>): void;
|
removeObserver(observer: Observer<T | undefined>): void;
|
||||||
|
2
doric-js/lib/src/runtime/global.d.ts
vendored
2
doric-js/lib/src/runtime/global.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import { Panel } from "../ui/panel";
|
import { Panel } from "../ui/panel";
|
||||||
import { ClassType } from "../util/types";
|
import { ClassType } from "../util/types";
|
||||||
export type BridgeContext = {
|
export declare type BridgeContext = {
|
||||||
/**
|
/**
|
||||||
* The identify of current context
|
* The identify of current context
|
||||||
*/
|
*/
|
||||||
|
6
doric-js/lib/src/runtime/sandbox.d.ts
vendored
6
doric-js/lib/src/runtime/sandbox.d.ts
vendored
@ -23,9 +23,9 @@ export declare function jsObtainContext(id: string): Context | undefined;
|
|||||||
export declare function jsReleaseContext(id: string): void;
|
export declare function jsReleaseContext(id: string): void;
|
||||||
export declare function __require__(name: string): any;
|
export declare function __require__(name: string): any;
|
||||||
export declare function jsRegisterModule(name: string, moduleObject: any): void;
|
export declare function jsRegisterModule(name: string, moduleObject: any): void;
|
||||||
export declare function jsCallEntityMethod(contextId: string, methodName: string, args?: any): unknown;
|
export declare function jsCallEntityMethod(contextId: string, methodName: string, args?: any): any;
|
||||||
export declare function pureCallEntityMethod(contextId: string, methodName: string, args?: any): unknown;
|
export declare function pureCallEntityMethod(contextId: string, methodName: string, args?: any): any;
|
||||||
type ClassType<T> = new (...args: any) => T;
|
declare type ClassType<T> = new (...args: any) => T;
|
||||||
export declare function jsObtainEntry(contextId: string): () => ClassType<object> | ((constructor: ClassType<object>) => ClassType<object>);
|
export declare function jsObtainEntry(contextId: string): () => ClassType<object> | ((constructor: ClassType<object>) => ClassType<object>);
|
||||||
export declare function jsCallbackTimer(timerId: number): void;
|
export declare function jsCallbackTimer(timerId: number): void;
|
||||||
export declare function jsHookAfterNativeCall(): void;
|
export declare function jsHookAfterNativeCall(): void;
|
||||||
|
@ -71,16 +71,6 @@ export function jsCallReject(contextId, callbackId, args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class Context {
|
export class Context {
|
||||||
hookBeforeNativeCall() {
|
|
||||||
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
|
||||||
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hookAfterNativeCall() {
|
|
||||||
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
|
||||||
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
this.callbacks = new Map;
|
this.callbacks = new Map;
|
||||||
this.classes = new Map;
|
this.classes = new Map;
|
||||||
@ -115,6 +105,16 @@ export class Context {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
hookBeforeNativeCall() {
|
||||||
|
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
||||||
|
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hookAfterNativeCall() {
|
||||||
|
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
||||||
|
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
||||||
|
}
|
||||||
|
}
|
||||||
callNative(namespace, method, args) {
|
callNative(namespace, method, args) {
|
||||||
const callbackId = uniqueId('callback');
|
const callbackId = uniqueId('callback');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
2
doric-js/lib/src/ui/animation.d.ts
vendored
2
doric-js/lib/src/ui/animation.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import { Color } from "../util/color";
|
import { Color } from "../util/color";
|
||||||
import { Modeling, Model } from "../util/types";
|
import { Modeling, Model } from "../util/types";
|
||||||
export type AnimatedKey = "translationX" | "translationY" | "scaleX" | "scaleY" | "rotation" | "pivotX" | "pivotY" | "rotationX" | "rotationY" | "backgroundColor" | "alpha";
|
export declare type AnimatedKey = "translationX" | "translationY" | "scaleX" | "scaleY" | "rotation" | "pivotX" | "pivotY" | "rotationX" | "rotationY" | "backgroundColor" | "alpha";
|
||||||
export declare enum RepeatMode {
|
export declare enum RepeatMode {
|
||||||
RESTART = 1,
|
RESTART = 1,
|
||||||
REVERSE = 2
|
REVERSE = 2
|
||||||
|
8
doric-js/lib/src/ui/view.d.ts
vendored
8
doric-js/lib/src/ui/view.d.ts
vendored
@ -7,14 +7,14 @@ import { FlexConfig } from "../util/flexbox";
|
|||||||
export declare function Property(target: Object, propKey: string): void;
|
export declare function Property(target: Object, propKey: string): void;
|
||||||
export declare function InconsistProperty(target: Object, propKey: string): void;
|
export declare function InconsistProperty(target: Object, propKey: string): void;
|
||||||
export declare function ViewComponent(constructor: ClassType<any>): void;
|
export declare function ViewComponent(constructor: ClassType<any>): void;
|
||||||
export type NativeViewModel = {
|
export declare type NativeViewModel = {
|
||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
props: {
|
props: {
|
||||||
[index: string]: Model;
|
[index: string]: Model;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
type RefType<T> = T extends Ref<infer R> ? R : never;
|
declare type RefType<T> = T extends Ref<infer R> ? R : never;
|
||||||
export declare class Ref<T extends View> {
|
export declare class Ref<T extends View> {
|
||||||
private view?;
|
private view?;
|
||||||
set current(v: T);
|
set current(v: T);
|
||||||
@ -151,8 +151,8 @@ export declare abstract class Superview extends View {
|
|||||||
clean(): void;
|
clean(): void;
|
||||||
toModel(): NativeViewModel;
|
toModel(): NativeViewModel;
|
||||||
}
|
}
|
||||||
export type ViewArray = View[];
|
export declare type ViewArray = View[];
|
||||||
export type ViewFragment = View | ViewArray | undefined | null;
|
export declare type ViewFragment = View | ViewArray | undefined | null;
|
||||||
export declare abstract class Group extends Superview implements JSX.ElementChildrenAttribute {
|
export declare abstract class Group extends Superview implements JSX.ElementChildrenAttribute {
|
||||||
padding?: {
|
padding?: {
|
||||||
left?: number;
|
left?: number;
|
||||||
|
@ -43,24 +43,6 @@ export function createRef() {
|
|||||||
return new Ref;
|
return new Ref;
|
||||||
}
|
}
|
||||||
export class View {
|
export class View {
|
||||||
callback2Id(f) {
|
|
||||||
const id = uniqueId('Function');
|
|
||||||
this.callbacks.set(id, f);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
id2Callback(id) {
|
|
||||||
let f = this.callbacks.get(id);
|
|
||||||
if (f === undefined) {
|
|
||||||
f = Reflect.get(this, id);
|
|
||||||
}
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
findViewByTag(tag) {
|
|
||||||
if (tag === this.tag) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.width = 0;
|
this.width = 0;
|
||||||
this.height = 0;
|
this.height = 0;
|
||||||
@ -92,6 +74,24 @@ export class View {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
callback2Id(f) {
|
||||||
|
const id = uniqueId('Function');
|
||||||
|
this.callbacks.set(id, f);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
id2Callback(id) {
|
||||||
|
let f = this.callbacks.get(id);
|
||||||
|
if (f === undefined) {
|
||||||
|
f = Reflect.get(this, id);
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
findViewByTag(tag) {
|
||||||
|
if (tag === this.tag) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
/** Anchor start*/
|
/** Anchor start*/
|
||||||
get left() {
|
get left() {
|
||||||
return this.x;
|
return this.x;
|
||||||
|
2
doric-js/lib/src/util/flexbox.d.ts
vendored
2
doric-js/lib/src/util/flexbox.d.ts
vendored
@ -64,7 +64,7 @@ export declare enum Display {
|
|||||||
FLEX = 0,
|
FLEX = 0,
|
||||||
NONE = 1
|
NONE = 1
|
||||||
}
|
}
|
||||||
export type FlexValue = FlexTypedValue | number;
|
export declare type FlexValue = FlexTypedValue | number;
|
||||||
export interface FlexConfig {
|
export interface FlexConfig {
|
||||||
direction?: Direction;
|
direction?: Direction;
|
||||||
flexDirection?: FlexDirection;
|
flexDirection?: FlexDirection;
|
||||||
|
8
doric-js/lib/src/util/types.d.ts
vendored
8
doric-js/lib/src/util/types.d.ts
vendored
@ -2,11 +2,11 @@ export interface Modeling {
|
|||||||
toModel(): Model;
|
toModel(): Model;
|
||||||
}
|
}
|
||||||
export declare function obj2Model(obj: Model, convertor: (v: Function) => string): Model;
|
export declare function obj2Model(obj: Model, convertor: (v: Function) => string): Model;
|
||||||
type _M = string | number | boolean | Modeling | {
|
declare type _M = string | number | boolean | Modeling | {
|
||||||
[index: string]: Model;
|
[index: string]: Model;
|
||||||
} | undefined;
|
} | undefined;
|
||||||
export type Model = _M | Array<_M>;
|
export declare type Model = _M | Array<_M>;
|
||||||
export type Binder<T> = (v: T) => void;
|
export declare type Binder<T> = (v: T) => void;
|
||||||
export declare class Mutable<T> {
|
export declare class Mutable<T> {
|
||||||
private val;
|
private val;
|
||||||
private binders;
|
private binders;
|
||||||
@ -16,5 +16,5 @@ export declare class Mutable<T> {
|
|||||||
bind(binder: Binder<T>): void;
|
bind(binder: Binder<T>): void;
|
||||||
static of<E>(v: E): Mutable<E>;
|
static of<E>(v: E): Mutable<E>;
|
||||||
}
|
}
|
||||||
export type ClassType<T> = new (...args: any) => T;
|
export declare type ClassType<T> = new (...args: any) => T;
|
||||||
export {};
|
export {};
|
||||||
|
56
doric-web/dist/index.js
vendored
56
doric-web/dist/index.js
vendored
@ -1278,16 +1278,6 @@ var doric = (function (exports) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Context {
|
class Context {
|
||||||
hookBeforeNativeCall() {
|
|
||||||
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
|
||||||
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hookAfterNativeCall() {
|
|
||||||
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
|
||||||
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
this.callbacks = new Map;
|
this.callbacks = new Map;
|
||||||
this.classes = new Map;
|
this.classes = new Map;
|
||||||
@ -1322,6 +1312,16 @@ var doric = (function (exports) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
hookBeforeNativeCall() {
|
||||||
|
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
||||||
|
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hookAfterNativeCall() {
|
||||||
|
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
||||||
|
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
||||||
|
}
|
||||||
|
}
|
||||||
callNative(namespace, method, args) {
|
callNative(namespace, method, args) {
|
||||||
const callbackId = uniqueId('callback');
|
const callbackId = uniqueId('callback');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -1776,24 +1776,6 @@ function createRef() {
|
|||||||
return new Ref;
|
return new Ref;
|
||||||
}
|
}
|
||||||
class View {
|
class View {
|
||||||
callback2Id(f) {
|
|
||||||
const id = uniqueId('Function');
|
|
||||||
this.callbacks.set(id, f);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
id2Callback(id) {
|
|
||||||
let f = this.callbacks.get(id);
|
|
||||||
if (f === undefined) {
|
|
||||||
f = Reflect.get(this, id);
|
|
||||||
}
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
findViewByTag(tag) {
|
|
||||||
if (tag === this.tag) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.width = 0;
|
this.width = 0;
|
||||||
this.height = 0;
|
this.height = 0;
|
||||||
@ -1825,6 +1807,24 @@ class View {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
callback2Id(f) {
|
||||||
|
const id = uniqueId('Function');
|
||||||
|
this.callbacks.set(id, f);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
id2Callback(id) {
|
||||||
|
let f = this.callbacks.get(id);
|
||||||
|
if (f === undefined) {
|
||||||
|
f = Reflect.get(this, id);
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
findViewByTag(tag) {
|
||||||
|
if (tag === this.tag) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
/** Anchor start*/
|
/** Anchor start*/
|
||||||
get left() {
|
get left() {
|
||||||
return this.x;
|
return this.x;
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user