Global

Methods

(async) WDwdataTweq(yearStart, yearEnd, optopt) → {Object}

Description:
  • 基於檔案之下載台灣氣象署地震數據與任務建構器

    因各檔案小,真實數據直接視為hash數據做差異比對

    執行階段最新數據放置於fdDwAttime,前次數據會於結束前自動備份至fdDwCurrent

Source:
Example
import w from 'wsemi'
import WDwdataTweq from './src/WDwdataTweq.mjs'

//fdTagRemove
let fdTagRemove = `./_tagRemove`
w.fsCleanFolder(fdTagRemove)

//fdDwAttime
let fdDwAttime = `./_dwAttime`
w.fsCleanFolder(fdDwAttime)

//fdDwCurrent
let fdDwCurrent = `./_dwCurrent`
w.fsCleanFolder(fdDwCurrent)

//fdResult
let fdResult = `./_result`
w.fsCleanFolder(fdResult)

//fdTaskCpActualSrc
let fdTaskCpActualSrc = `./_taskCpActualSrc`
w.fsCleanFolder(fdTaskCpActualSrc)

//fdTaskCpSrc
let fdTaskCpSrc = `./_taskCpSrc`
w.fsCleanFolder(fdTaskCpSrc)

let yearStart = 2022
let yearEnd = 2022
let opt = {
    fdTagRemove,
    fdDwAttime,
    fdDwCurrent,
    fdResult,
    fdTaskCpActualSrc,
    fdTaskCpSrc,
    // fdLog,
    // funDownload,
    // funGetCurrent,
    // funRemove,
    // funAdd,
    // funModify,
}
let ev = await WDwdataTweq(yearStart, yearEnd, opt)
    .catch((err) => {
        console.log(err)
    })
ev.on('change', (msg) => {
    delete msg.type
    console.log('change', msg)
})
// change { event: 'start', msg: 'running...' }
// change { event: 'proc-callfun-afterStart', msg: 'start...' }
// change { event: 'proc-callfun-afterStart', msg: 'done' }
// change { event: 'proc-callfun-download', msg: 'start...' }
// change { event: 'proc-callfun-download', num: 2, msg: 'done' }
// change { event: 'proc-callfun-getCurrent', msg: 'start...' }
// change { event: 'proc-callfun-getCurrent', num: 0, msg: 'done' }
// change { event: 'proc-compare', msg: 'start...' }
// change { event: 'proc-compare', numRemove: 0, numAdd: 2, numModify: 0, numSame: 0, msg: 'done' }
// change { event: 'proc-add-callfun-add', id: '111001', msg: 'start...' }
// change { event: 'proc-add-callfun-add', id: '111001', msg: 'done' }
// change { event: 'proc-add-callfun-add', id: '111002', msg: 'start...' }
// change { event: 'proc-add-callfun-add', id: '111002', msg: 'done' }
// ...
Parameters:
Name Type Attributes Default Description
yearStart Integer

輸入數據開始年整數

yearEnd Integer

輸入數據結束年整數

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyId String <optional>
'keyId'

輸入各筆數據之主鍵字串,預設'keyId'

fdTagRemove String <optional>
'./_tagRemove'

輸入暫存標記為刪除數據資料夾字串,預設'./_tagRemove'

fdDwAttime String <optional>
'./_dwAttime'

輸入當前下載數據資料夾字串,預設'./_dwAttime'

fdDwCurrent String <optional>
'./_dwCurrent'

輸入已下載數據資料夾字串,預設'./_dwCurrent'

fdResult String <optional>
'./_result'

輸入已下載數據所連動生成數據資料夾字串,預設'./_result'

fdTaskCpActualSrc String <optional>
'./_taskCpActualSrc'

輸入任務狀態之來源端完整資料夾字串,預設'./_taskCpActualSrc'

fdTaskCpSrc String <optional>
'./_taskCpSrc'

輸入任務狀態之來源端資料夾字串,預設'./_taskCpSrc'

fdLog String <optional>
'./_logs'

輸入儲存log資料夾字串,預設'./_logs'

funDownload function <optional>
null

輸入取得當前下載數據之函數,回傳資料陣列,預設null

funGetCurrent function <optional>
null

輸入取得已下載數據之函數,回傳資料陣列,預設null

funAdd function <optional>
null

輸入當有新資料時,需要連動處理之函數,預設null

funModify function <optional>
null

輸入當有資料需更新時,需要連動處理之函數,預設null

funRemove function <optional>
null

輸入當有資料需刪除時,需要連動處理之函數,預設null

timeToleranceRemove Number <optional>
0

輸入刪除任務之防抖時長,單位ms,預設0,代表不使用

Returns:

回傳事件物件,可呼叫函數on監聽change事件

Type
Object