jstask

package
v0.0.0-...-212a885 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

* @Date: 2021-08-15 23:11:38 * @LastEditors: Wangjun * @LastEditTime: 2023-03-15 18:39:39 * @FilePath: \golib\js\jstask\boss.go * @Description:

* @Author: Wangjun * @Date: 2021-08-16 09:07:58 * @LastEditTime: 2023-07-31 19:07:07 * @LastEditors: Wangjun * @Description: * @FilePath: \golib\js\jstask\task.go * hnxr

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitAsynJs

func InitAsynJs(path string, initCallback CallBack)

InitAsynJs 初始化异步任务

func InitSyncJs

func InitSyncJs(path string, initFunc CallBack)

InitSyncJs 初始化同步的任务 *

  • @description:
  • @param {string} path
  • @param {func} initFunc 并发执行时,重新初始化脚本时的回调初始化函数
  • @return {*}

Types

type AsyncTask

type AsyncTask struct {
	Tasks
}

AsyncTask 异步

func (*AsyncTask) GetTasks

func (m *AsyncTask) GetTasks() []*Task

GetTasks 获取全部的任务

type Boss

type Boss struct {
	SyncTask  SyncTask
	AsyncTask AsyncTask
	// contains filtered or unexported fields
}

func GetTasks

func GetTasks() *Boss

GetLuadbBoss 获取管理boss

type CallBack

type CallBack func(vm *goja.Runtime) any

type SyncTask

type SyncTask struct {
	// contains filtered or unexported fields
}

SyncTask 异步

func (*SyncTask) GetTasks

func (m *SyncTask) GetTasks() []*Task

GetTasks 获取全部的任务

type Task

type Task struct {
	Time         string //执行时间
	Path         string //路径
	Desc         string //描述
	UsedTime     string //执行任务耗时
	LastCallTime int64  //最后一次调用的开始时间
	Msg          string
	Count        int
	Running      bool //执行状态

	ID int

	Timeout int64 // 超时时间, 如果超过这个时间还没有执行完,则继续执行
	// contains filtered or unexported fields
}

Task .

func (*Task) Cancel

func (m *Task) Cancel()

Cancel 取消任务

func (*Task) Run

func (m *Task) Run()

type Tasks

type Tasks struct {
	Time string
	ID   int
	// contains filtered or unexported fields
}

Tasks 任务组

func (*Tasks) Run

func (m *Tasks) Run()

Run 运行任务

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL