tencent cloud

Tencent Cloud Observability Platform

Release Notes and Announcements
Release Notes
Product Introduction
Overview
Strengths
Basic Features
Basic Concepts
Use Cases
Use Limits
Purchase Guide
Tencent Cloud Product Monitoring
Application Performance Management
Mobile App Performance Monitoring
Real User Monitoring
Cloud Automated Testing
Prometheus Monitoring
Grafana
EventBridge
PTS
Quick Start
Monitoring Overview
Instance Group
Tencent Cloud Product Monitoring
Application Performance Management
Real User Monitoring
Cloud Automated Testing
Performance Testing Service
Prometheus Getting Started
Grafana
Dashboard Creation
EventBridge
Alarm Service
Cloud Product Monitoring
Tencent Cloud Service Metrics
Operation Guide
CVM Agents
Cloud Product Monitoring Integration with Grafana
Troubleshooting
Practical Tutorial
Application Performance Management
Product Introduction
Access Guide
Operation Guide
Practical Tutorial
Parameter Information
FAQs
Mobile App Performance Monitoring
Overview
Operation Guide
Access Guide
Practical Tutorial
Tencent Cloud Real User Monitoring
Product Introduction
Operation Guide
Connection Guide
FAQs
Cloud Automated Testing
Product Introduction
Operation Guide
FAQs
Performance Testing Service
Overview
Operation Guide
Practice Tutorial
JavaScript API List
FAQs
Prometheus Monitoring
Product Introduction
Access Guide
Operation Guide
Practical Tutorial
Terraform
FAQs
Grafana
Product Introduction
Operation Guide
Guide on Grafana Common Features
FAQs
Dashboard
Overview
Operation Guide
Alarm Management
Console Operation Guide
Troubleshooting
FAQs
EventBridge
Product Introduction
Operation Guide
Practical Tutorial
FAQs
Report Management
FAQs
General
Alarm Service
Concepts
Monitoring Charts
CVM Agents
Dynamic Alarm Threshold
CM Connection to Grafana
Documentation Guide
Related Agreements
Application Performance Management Service Level Agreement
APM Privacy Policy
APM Data Processing And Security Agreement
RUM Service Level Agreement
Mobile Performance Monitoring Service Level Agreement
Cloud Automated Testing Service Level Agreement
Prometheus Service Level Agreement
TCMG Service Level Agreements
PTS Service Level Agreement
PTS Use Limits
Cloud Monitor Service Level Agreement
API Documentation
History
Introduction
API Category
Making API Requests
Monitoring Data Query APIs
Alarm APIs
Legacy Alert APIs
Notification Template APIs
TMP APIs
Grafana Service APIs
Event Center APIs
TencentCloud Managed Service for Prometheus APIs
Monitoring APIs
Data Types
Error Codes
Glossary

Common Functions

PDF
フォーカスモード
フォントサイズ
最終更新日: 2025-03-10 22:14:18

Public JavaScript Library

Native JavaScript syntax is fully supported. For details, see JavaScript Standard Built-in Objects. Below are some basic demos.
Create a JavaScript Date Instance
// Create a JavaScript Date Instance
export default function () {
// supported date functions, refer: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Date
console.log(new Date('1995-12-17T03:24:00')); // Sun Dec 17 1995 11:24:00 GMT+0800 (CST)
};
JSON Parse and Stringify
// JSON parse and stringify

export default function () {
const jsonStr = `{
"name": "pts",
"language": "javascript"
}`;
// parse json string to json object
const jsonObj = JSON.parse(jsonStr);
console.log(jsonObj.name); // pts
// convert json string to json object
const convertedStr = JSON.stringify(jsonObj);
console.log(convertedStr); // {"name":"pts","language":"javascript"}
};
Use Math Functions
// Use Math functions
export default function () {
// supported math functions, refer: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Math
console.log(Math.pow(2, 10)); // 1024
// Returns a random integer from 0 to 9:
console.log(Math.floor(Math.random() * 10));
};
Use RegExp Object for Matching Text with Pattern
// Use RegExp Object for matching text with pattern
export default function () {
// supported regexp functions, refer: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp
let re = /(\\w+)\\s(\\w+)/;
let str = "John Smith";
let newStr = str.replace(re, "$2, $1");
console.log(newStr); // Smith, John
};

PTS Expansion Library

Base64 Encode & Decode
// Base64 Encode & Decode
import util from 'pts/util';

export default function () {
const base64Encoded = util.base64Encoding("Hello, world");
console.log(base64Encoded); // SGVsbG8sIHdvcmxk

const base64Decoded = util.base64Decoding(base64Encoded);
console.log(base64Decoded); // Hello, world
}
Generate UUID
// Generate UUID
import util from 'pts/util';

export default function () {
console.log(util.uuid()); // 5fbf1e59-cabf-469b-9d9f-6622e97de1ec
}



ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック