TypeScript web-push setGCMAPIKey示例

说明

typescript web-push setgcmapikey示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: TypeScript

命名空间/包名称: web-push

示例#1
文件: web-push-tests.ts 项目: Jeremy-F/DefinitelyTyped

// =====================

// $ExpectType VapidKeys
const vapidKeys = generateVAPIDKeys();

// $ExpectType string
vapidKeys.publicKey;
// $ExpectType string
vapidKeys.privateKey;

// ================
//  setGCMAPIKey()
// ================

// $ExpectType void
setGCMAPIKey('apiKey');
// $ExpectType void
setGCMAPIKey(null);

// ===================
//  setVapidDetails()
// ===================

// $ExpectType void
setVapidDetails('subject', 'privateKey', 'publicKey');

// Buffers are not supported here
// $ExpectError
setVapidDetails(buffer, 'publicKey', 'privateKey');
// $ExpectError
setVapidDetails('subject', buffer, 'privateKey');

示例#2
文件: push.ts 项目: SuperSoe/mobile-toolkit

export function setGCMAPIKey(key: string): void {
  push.setGCMAPIKey(key);
}

展开阅读全文