g
This commit is contained in:
@@ -38,18 +38,19 @@
|
||||
coop_mind_log_id: 0,
|
||||
// 定时备份数据
|
||||
timer_push_task: null,
|
||||
// 定时获得变化
|
||||
timer_fetch_task: null,
|
||||
// web_socket
|
||||
web_socket: null,
|
||||
// init
|
||||
_init: function (_jm) {
|
||||
if (!this._jm) {
|
||||
this._jm = _jm
|
||||
|
||||
// 添加事件处理
|
||||
_jm.add_event_listener(jsMindCallBackFacade)
|
||||
|
||||
// 初始化属性
|
||||
this._init_properties(_jm)
|
||||
|
||||
// 初始化websocket
|
||||
this._init_ws()
|
||||
|
||||
@@ -109,9 +110,6 @@
|
||||
if (this.timer_push_task) {
|
||||
$w.clearInterval(this.timer_push_task)
|
||||
}
|
||||
if (this.timer_fetch_task) {
|
||||
$w.clearInterval(this.timer_fetch_task)
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 是否为空
|
||||
@@ -180,7 +178,7 @@
|
||||
*/
|
||||
js_mind_callback_: function (type, body) {
|
||||
const evt = body.evt
|
||||
if (!!evt) {
|
||||
if (this.should_handle_evt(evt)) {
|
||||
const param = this._build_evt_param()
|
||||
Jm.util.json.merge(body, param)
|
||||
|
||||
@@ -190,6 +188,9 @@
|
||||
this._send_ws_message(msg)
|
||||
}
|
||||
},
|
||||
should_handle_evt: function (evt) {
|
||||
return evt && ['add_node', 'insert_node_before', 'insert_node_after', 'remove_node', 'update_node', 'move_node'].includes(evt)
|
||||
},
|
||||
// 处理特殊字符
|
||||
handle_spec_str: function (msg) {
|
||||
if (!!msg) {
|
||||
@@ -214,11 +215,12 @@
|
||||
if (this._is_null(me.timer_push_task)) {
|
||||
me.timer_push_task = setInterval(function () {
|
||||
const param = {
|
||||
'data': Jm.util.json.json2string(me._jm.get_data('node_array').data),
|
||||
'data': Jm.util.json.json2string(me._jm.get_data('node_tree').data),
|
||||
'client_id': me.client_id,
|
||||
'coop_mind_id': me.coop_mind_id,
|
||||
'coop_mind_log_id': me.coop_mind_log_id,
|
||||
'type': 'snapshot'
|
||||
'type': 'snapshot',
|
||||
'data_format': 'node_tree'
|
||||
}
|
||||
Jm.util.ajax.post(me.coop_api_url, param, function (resp) {
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user