WSyncWebdataServer

WSyncWebdataServer

new WSyncWebdataServer(optopt) → {Object}

Description:
  • 伺服器端之資料同步器

Source:
Example
Parameters:
Name Type Attributes Default Description
opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
fnTableTags Integer <optional>
'tableTags.json'

輸入各資料表時間戳儲存檔案名稱字串,預設'tableTags.json'

Returns:

回傳後端資料同步物件,可監聽事件changeTableTags、error,可使用函數readTableTags、writeTableTags、initTableTags、setTableTags、getTableTags、updateTableTag

Type
Object

Methods

(static) getTableTags() → {Object}

Description:
  • 直接取得各資料表時間資料

Source:
Example
let tableTags = wsds.getTableTags()
Returns:

回傳各資料表時間戳物件

Type
Object

(static) initTableTags(tableTags, modeopt) → {Undefined}

Description:
  • 初始化各資料表時間資料

Source:
Example
let tableTags = {...}
let mode = ''
wsds.initTableTags(tableTags, mode)
Parameters:
Name Type Attributes Default Description
tableTags Object

輸入各資料表時間戳物件

mode String <optional>
'useInputFirst'

輸入使用設定方式字串,可有'useInputFirst'代表使用傳入設定優先再與既有JSON檔設定合併,為預設值,'useStorageFirst'代表使用既有JSON檔設定優先再與傳入設定合併,'useInputOnly'代表只使用傳入設定,'useStorageOnly'代表只使用既有JSON檔設定

Returns:

無回傳

Type
Undefined

(static) onChangeUpdateTableTag(nowTableTags)

Description:
  • 監聽更新資料表事件,當外部監聽收到更新通知時再推播nowTableTags至前端

Source:
Example
wo.on('changeTableTags', function(nowTableTags) {
    ...
})
Parameters:
Name Type Description
nowTableTags Object

各資料表時間戳物件

(static) readTableTags() → {Object}

Description:
  • 讀取各資料表時間資料

Source:
Example
let tableTags = wsds.readTableTags()
Returns:

回傳各資料表時間戳物件

Type
Object

(static) setTableTags(tableTags) → {Undefined}

Description:
  • 直接設定各資料表時間資料

Source:
Example
let tableTags = {...}
wsds.setTableTags(tableTags)
Parameters:
Name Type Description
tableTags Object

輸入各資料表時間戳物件

Returns:

無回傳

Type
Undefined

(static) updateTableTag(tableTag) → {Undefined}

Description:
  • 更新指定資料表之時間戳,當資料表更新時需調用此函數

Source:
Example
let tableName = '...'
wsds.updateTableTag(tableName)
Parameters:
Name Type Description
tableTag String

輸入欲更新指定資料表名稱字串

Returns:

無回傳

Type
Undefined

(static) writeTableTags(tableTags) → {Undefined}

Description:
  • 儲存各資料表時間資料

Source:
Example
let tableTags = {...}
wsds.writeTableTags(tableTags)
Parameters:
Name Type Description
tableTags Object

輸入各資料表時間戳物件

Returns:

無回傳

Type
Undefined