Artyom.js 中文翻译
  • Artyom
  • FAQ
  • 翻译相关
  • 开始
    • 简介
    • 必要条件
    • Changelog
  • API
    • isObeying
    • addCommands
    • clearGarbageCollection
    • debug
    • detectErrors
    • device
    • emptyCommands
    • fatality
    • getAvailableCommands
    • getLanguage
    • getProperties
    • getVoices
    • initialize
    • isRecognizing
    • isSpeaking
    • newDictation
    • newPrompt
    • obey
    • on
    • recognizingSupported
    • redirectRecognizedTextOutput
    • remoteProcessorService
    • removeCommands
    • repeatLastSay
    • restart
    • say
    • sayRandom
    • setDebug
    • Shutup
    • simulateInstruction
    • speechSupported
    • when
Powered by GitBook
On this page

Was this helpful?

  1. API

device

获取使用 Artyom 的设备的相关信息

artyom 的 device 属性是一个包含两个属性的简单对象:

Property

type

Description

isMobile

Boolean

当设备不是台式/笔记本电脑时返回true

isChrome

Boolean

当浏览器是Google Chrome时返回true

你可以使用这个方法验证浏览器是否是 Chrome,同时提示用户(比如提示在移动设备上artyom 无法指定语言):

let artyom = new Artyom();

// Verify if artyom is supported
window.onload = function(){
    if(artyom.Device.isChrome){
        if(!artyom.Device.isMobile){
            alert("Artyom can talk and obey commands in this browser, however the voice will be the default voice of the device. Cannot force language here.");
        }else{
            // Everything okay ! , use artyom normally here !
        }
    }else{
        alert("Artyom only works with The Google Chrome Browser !");
    }
};
PreviousdetectErrorsNextemptyCommands

Last updated 5 years ago

Was this helpful?