clickgo 3.1.0-dev9 → 3.1.2-dev11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/task.ts CHANGED
@@ -29,29 +29,6 @@ export const list: Record<number, types.ITask> = {};
29
29
  /** --- 最后一个 task id,App 模式下无效 --- */
30
30
  export let lastId: number = 0;
31
31
 
32
- /** --- 当前是否设置的主任务的任务 ID,全局只可设置一次 --- */
33
- let mainTaskId: number = 0;
34
-
35
- /**
36
- * --- 将一个任务设置为主任务,全局只可设置一次 ---
37
- * @param taskId 任务 ID
38
- */
39
- export function setMain(taskId: number): boolean {
40
- if (mainTaskId > 0) {
41
- return false;
42
- }
43
- mainTaskId = taskId;
44
- return true;
45
- }
46
-
47
- /**
48
- * --- 判断一个任务 ID 是不是主任务 ---
49
- * @param taskId 任务 ID
50
- */
51
- export function isMain(taskId: number): boolean {
52
- return taskId === mainTaskId;
53
- }
54
-
55
32
  /** --- task lib 用到的语言包 --- */
56
33
  const localeData: Record<string, {
57
34
  'loading': string;
@@ -347,12 +324,18 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
347
324
  getVersion: function(): string {
348
325
  return clickgo.getVersion();
349
326
  },
350
- getNative(): boolean {
351
- return clickgo.getNative();
327
+ isNative(): boolean {
328
+ return clickgo.isNative();
352
329
  },
353
330
  getPlatform(): string {
354
331
  return clickgo.getPlatform();
355
332
  },
333
+ isImmersion(): boolean {
334
+ return clickgo.isImmersion();
335
+ },
336
+ hasFrame(): boolean {
337
+ return clickgo.hasFrame();
338
+ },
356
339
  'control': {
357
340
  'AbstractControl': class extends control.AbstractControl {
358
341
  public get taskId(): number {
@@ -715,9 +698,6 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
715
698
  }
716
699
  },
717
700
  'task': {
718
- isMain(taskId: number): boolean {
719
- return isMain(taskId);
720
- },
721
701
  onFrame: function(fun: () => void | Promise<void>, opt: any = {}): number {
722
702
  opt.taskId = taskId;
723
703
  return clickgo.task.onFrame(fun, opt);
@@ -736,7 +716,6 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
736
716
  },
737
717
  run: function(url: string, opt: types.ITaskRunOptions = {}): Promise<number> {
738
718
  opt.taskId = taskId;
739
- opt.main = false;
740
719
  return clickgo.task.run(url, opt);
741
720
  },
742
721
  end: function(tid: number): boolean {
@@ -836,6 +815,9 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
836
815
  getBoolean: function(param: boolean | string | number): boolean {
837
816
  return clickgo.tool.getBoolean(param);
838
817
  },
818
+ getNumber: function(param: string | number): number {
819
+ return clickgo.tool.getNumber(param);
820
+ },
839
821
  escapeHTML: function(html: string): string {
840
822
  return clickgo.tool.escapeHTML(html);
841
823
  },
@@ -932,6 +914,12 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
932
914
  }
933
915
  // --- 创建 Task 总 style ---
934
916
  dom.createToStyleList(taskId);
917
+ // --- 触发 taskStarted 事件 ---
918
+ core.trigger('taskStarted', taskId);
919
+ // --- 第一个任务给 native 发送任务启动成功的消息 ---
920
+ if (taskId === 1) {
921
+ native.invoke('cg-init', native.getToken());
922
+ }
935
923
  // --- 执行 app ---
936
924
  const appCls: core.AbstractApp = new expo.default();
937
925
  await appCls.main();
@@ -940,25 +928,9 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
940
928
  // --- 结束任务 ---
941
929
  delete list[taskId];
942
930
  dom.removeFromStyleList(taskId);
931
+ core.trigger('taskEnded', taskId);
943
932
  return -4;
944
933
  }
945
- // --- 触发 taskStarted 事件 ---
946
- core.trigger('taskStarted', taskId);
947
- // --- 给 native 发送任务启动成功的消息 ---
948
- if (taskId === 1) {
949
- native.invoke('cg-init', native.getToken());
950
- }
951
- // --- 提交 sync ---
952
- /*
953
- if (clickgo.getNative() && opt.sync) {
954
- f.vroot.$refs.form.isNativeSync = true;
955
- native.invoke('cg-set-size', native.getToken(), f.vroot.$refs.form.widthData, f.vroot.$refs.form.heightData);
956
- window.addEventListener('resize', function(): void {
957
- f.vroot.$refs.form.setPropData('width', window.innerWidth);
958
- f.vroot.$refs.form.setPropData('height', window.innerHeight);
959
- });
960
- }
961
- */
962
934
  return taskId;
963
935
  }
964
936
 
@@ -972,7 +944,7 @@ export function end(taskId: number): boolean {
972
944
  return true;
973
945
  }
974
946
  // --- 如果是 native 模式 ---
975
- if (clickgo.getNative() && isMain(taskId)) {
947
+ if (clickgo.isNative() && (taskId === 1)) {
976
948
  native.invoke('cg-close', native.getToken());
977
949
  }
978
950
  // --- 获取最大的 z index 窗体,并让他获取焦点 ---
@@ -988,7 +960,7 @@ export function end(taskId: number): boolean {
988
960
  // --- 移除窗体 list ---
989
961
  for (const fid in task.forms) {
990
962
  const f = task.forms[fid];
991
- core.trigger('formRemoved', taskId, f.id, f.vroot.$refs.form.title, f.vroot.$refs.form.iconData);
963
+ core.trigger('formRemoved', taskId, f.id, f.vroot.$refs.form.title, f.vroot.$refs.form.iconDataUrl);
992
964
  try {
993
965
  f.vapp.unmount();
994
966
  }
package/dist/lib/tool.ts CHANGED
@@ -631,5 +631,6 @@ export function execCommand(ac: string): void {
631
631
  if (!['copy', 'cut'].includes(ac)) {
632
632
  return;
633
633
  }
634
+ // eslint-disable-next-line deprecation/deprecation
634
635
  document.execCommand(ac);
635
636
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickgo",
3
- "version": "3.1.0-dev9",
3
+ "version": "3.1.2-dev11",
4
4
  "description": "Background interface, software interface, mobile phone APP interface operation library.",
5
5
  "keywords": [
6
6
  "deskrt",
package/types/index.d.ts CHANGED
@@ -1,17 +1,19 @@
1
- export let control: typeof import('../dist/lib/control');
2
- export let core: typeof import('../dist/lib/core');
3
- export let dom: typeof import('../dist/lib/dom');
4
- export let form: typeof import('../dist/lib/form');
5
- export let fs: typeof import('../dist/lib/fs');
6
- export let native: typeof import('../dist/lib/native');
7
- export let task: typeof import('../dist/lib/task');
8
- export let theme: typeof import('../dist/lib/theme');
9
- export let tool: typeof import('../dist/lib/tool');
10
- export let zip: typeof import('../dist/lib/zip');
1
+ export * as control from '../dist/lib/control';
2
+ export * as core from '../dist/lib/core';
3
+ export * as dom from '../dist/lib/dom';
4
+ export * as form from '../dist/lib/form';
5
+ export * as fs from '../dist/lib/fs';
6
+ export * as native from '../dist/lib/native';
7
+ export * as task from '../dist/lib/task';
8
+ export * as theme from '../dist/lib/theme';
9
+ export * as tool from '../dist/lib/tool';
10
+ export * as zip from '../dist/lib/zip';
11
11
 
12
12
  export function getVersion(): string;
13
- export function getNative(): boolean;
13
+ export function isNative(): boolean;
14
14
  export function getPlatform(): NodeJS.Platform | 'web';
15
+ export function isImmersion(): boolean;
16
+ export function hasFrame(): boolean;
15
17
  // eslint-disable-next-line @typescript-eslint/naming-convention
16
18
  export const AbstractBoot: typeof import('../dist/index').AbstractBoot;
17
19
  export function launcher(boot: import('../dist/index').AbstractBoot): void;
@@ -400,10 +402,6 @@ export interface ITaskRunOptions {
400
402
  'progress'?: (loaded: number, total: number) => void | Promise<void>;
401
403
  /** --- 显示 notify 窗口 --- */
402
404
  'notify'?: boolean;
403
- /** --- 设置为主应用,整个运行时只能设置一次,因此 App 下不可能被设置 --- */
404
- 'main'?: boolean;
405
- /** --- native 下窗体与实体窗体大小同步,App 模式下无法设置 --- */
406
- 'sync'?: boolean;
407
405
  /** --- 所属任务,App 模式无法设置 --- */
408
406
  'taskId'?: number;
409
407
  /** --- 不禁止某些浏览器对象,App 模式下无法设置 --- */
@@ -1,5 +0,0 @@
1
- <form width="200" height="200" title="From path">
2
- <layout align-v="center" align-h="center" style="flex: 1; width: 0;">
3
- <label>Haha!</label>
4
- </layout>
5
- </form>