快應(yīng)用 桌面圖標

2020-08-10 15:08 更新

接口聲明

{"name": "system.shortcut"}

導(dǎo)入模塊

import shortcut from '@system.shortcut' 
或 
const shortcut = require('@system.shortcut')

接口定義

shortcut.hasInstalled(OBJECT)

獲取桌面圖標是否創(chuàng)建

參數(shù):

參數(shù)名 類型 必填 說明
success Function 成功回調(diào)。參數(shù):true 已創(chuàng)建,false 未創(chuàng)建
fail Function 失敗回調(diào)
complete Function 執(zhí)行結(jié)束后的回調(diào)

示例:

shortcut.hasInstalled({
  success: function () {
    console.log('handling success')
  }
})

shortcut.install(OBJECT)

創(chuàng)建桌面圖標,每次創(chuàng)建都需要用戶授權(quán)

權(quán)限要求

創(chuàng)建桌面圖標

參數(shù):

參數(shù)名 類型 必填 說明
success Function 成功回調(diào)
fail Function 失敗回調(diào)
complete Function 執(zhí)行結(jié)束后的回調(diào)
fail返回錯誤代碼
錯誤碼 說明
201 用戶拒絕,獲取創(chuàng)建桌面圖標權(quán)限失敗

示例:

shortcut.install({
  success: function () {
    console.log('handling success')
  }
})

屬性

名稱參數(shù)類型是否可讀是否可寫描述
systemPromptEnabled 1020+ Boolean是否開啟系統(tǒng)快捷方式創(chuàng)建彈窗,默認 true。不會持久化,只對當前運行有效

示例:

shortcut.systemPromptEnabled = false
let enabled = shortcut.systemPromptEnabled
console.log('system prompt enabled: ' + enabled)

后臺運行限制

禁止使用。

后臺運行詳細用法參見 后臺運行腳本。


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號