1.0.5 • Published 2 years ago

@xybin1990/barkjs v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

@xybin1990/barkjs

安装

npm install @xybin1990/barkjs

使用

import { Bark } from '@xybin1990/barkjs';

const bark = new Bark({
  baseUrl: '', // 默认不传使用官方地址:https://api.day.app 或者可以设置自己部署的私有地址。
  key: '' // Bark 软件中生成的 Key。
})

bark.push({
  body: '' // 消息内容。 可以使用 '\n' 来达到换行的效果
})

Push data

字段数据类型是否必须说明
titlestring标题 会加粗显示
bodystring内容
categorystring预留字段 暂时忽略
automaticallyCopyboolean设置为 1 会自动将内容复制到剪切板
copystring指定复制的内容 否则为实际消息
urlstring点击推送跳转的 url
isArchivenumber是否保存推送记录 不指定则按照 APP 内的设定
groupstring消息分组
iconstring指定消息图标
soundstring设定提示音
levelstring设定时效性
badgenumber设定 APP 角标 可以设定任意数字

Sound Support

enum Sound {
  alarm              = 'alarm',
  anticipate         = 'anticipate',
  bell               = 'bell',
  birdsong           = 'birdsong',
  bloom              = 'birdsong',
  calypso            = 'birdsong',
  chime              = 'chime',
  choo               = 'choo',
  descent            = 'descent',
  electronic         = 'electronic',
  fanfare            = 'fanfare',
  glass              = 'glass',
  gotosleep          = 'gotosleep',
  healthnotification = 'healthnotification',
  horn               = 'horn',
  ladder             = 'ladder',
  mailsent           = 'mailsent',
  minuet             = 'minuet',
  multiwayinvitation = 'multiwayinvitation',
  newmail            = 'newmail',
  newsflash          = 'newsflash',
  noir               = 'noir',
  paymentsuccess     = 'paymentsuccess',
  shake              = 'shake',
  sherwoodforest     = 'sherwoodforest',
  silence            = 'silence',
  spell              = 'spell',
  suspense           = 'suspense',
  telegraph          = 'telegraph',
  tiptoes            = 'tiptoes',
  typewriters        = 'typewriters',
  update             = 'update',
}

Level 时效性说明

  • active: 不设置时的默认值,系统会立即亮屏显示通知。
  • timeSensitive:时效性通知,可在专注状态下显示通知。
  • passive: 仅将通知添加到通知列表,不会亮屏提醒
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago