Web Automation Processor

簡稱 WAP,是針對不同應用主題設計的自動化模組

WAP 包含兩大類:Edge Processor 與 Cloud Processor。其中 Edge Processor 的運算與資料處理都在使用者電腦上;而 Cloud Processor 則利用雲端運算資源來處理使用者的資料。

有提供 Low-Code 編輯器的 WAP 都提供常用同步函式 api:api.files(), api.read(filename, encoding='utf8'), api.write(filename, text), api.rename(oldname, newname), api.remove(filename)。另外 moment.js lodash 都是內建函式庫,可以直接使用:

// 一筆筆列出所有工作資料夾中的檔案
api.files().forEach((file) => console.log(file))

// 用 lodash.js _.filter() 函式過濾出檔名為 'jpg' 結尾的檔案,
const files = api.files()
console.log(_.filter(files, (file) => file.endsWith('jpg')))

// 讀取工作資料夾中的文字檔 price.txt
console.log(api.read('price.txt'))

// 使用 moment.js 產生自訂格式的日期字串,並寫出文字檔到工作資料夾中
api.write('time.txt', moment().format('HH:mm:ss'))

// 修改工作資料夾中的檔案名稱
api.rename('time.txt', 'currentTime.txt')

// 刪除工作資料夾中的檔案
api.remove('price.txt')

其他功能與專用 api 請參考以下章節對各種 WAP 的介紹。

Last updated