### Example: Configure domain for sub-path service (JavaScript)
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/domain.html
Alternative example configuration for the same sub-path service. Set `fundebug.domain` to the URL `https:///www.fundebug.com/static-type-checking/online`.
```javascript
if ("fundebug" in window) {
fundebug.domain = "https:///www.fundebug.com/static-type-checking/online";
}
```
--------------------------------
### Example: Configure domain for sub-path service (HTML)
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/domain.html
Example configuration for a service hosted at `https:///www.fundebug.com/static-type-checking/online`. Set the `domain` attribute in the `
```
--------------------------------
### systemInfo object example
Source: https://docs.fundebug.com/docs/notifier/aliapp/customize/setsysteminfo.html
Example of the systemInfo object that Fundebug can collect, showing fields like model, brand, language, version, storage, currentBattery, system, and platform.
```json
{
"model": "5",
"brand": "IPHONE",
"language": "zh-Hans",
"version": "10.1.12",
"storage": "62.42G",
"currentBattery": "50%",
"system": "6.0.1",
"platform": "iPhone"
}
```
--------------------------------
### Install fundebug-wxjs with npm
Source: https://docs.fundebug.com/docs/notifier/wxjs/integration/npm.html
Installs the fundebug-wxjs module via npm. Run this command in your project directory before initializing Fundebug.
```bash
npm install --save fundebug-wxjs
```
--------------------------------
### Initializing fundebug with releaseStage
Source: https://docs.fundebug.com/docs/notifier/wegame/customize/releasestage.html
Sets the releaseStage configuration option during fundebug initialization. The example uses 'development' as the stage. The API key is provided as a placeholder.
```js
fundebug.init({
apikey: "API-KEY",
releaseStage: "development"
});
```
--------------------------------
### Filter GET requests to example.com (>= 0.6.1)
Source: https://docs.fundebug.com/docs/notifier/wxjs/customize/filters.html
Filter HTTP requests based on URL and method using fundebug.init.
```javascript
fundebug.init(
{
filters: [
{
req:
{
url: /example\.com/,
method: /^GET$/
}
}]
})
```
--------------------------------
### 示例2:不监控发送到 example.com 的 GET 请求错误
Source: https://docs.fundebug.com/docs/notifier/wegame/customize/filters.html
通过 req.url 和 req.method 匹配特定请求。
```javascript
fundebug.init(
{
apikey: "API-KEY",
filters: [
{
req:
{
url: /example\.com/,
method: /^GET$/
}
}]
});
```
--------------------------------
### Example systemInfo object
Source: https://docs.fundebug.com/docs/notifier/wegame/customize/setsysteminfo.html
Shows the structure of the systemInfo object that is collected when setSystemInfo is true. It includes fields like system, model, pixelRatio, windowHeight, language, version, windowWidth, and platform.
```json
"systemInfo":
{
"system": "iOS 10.2",
"model": "iPhone 7",
"pixelRatio": 2,
"windowHeight": 603,
"language": "zh_CN",
"version": "6.5.3",
"windowWidth": 375,
"platform": "ios"
}
```
--------------------------------
### Install UglifyJS2 via npm
Source: https://docs.fundebug.com/docs/notifier/javascript/sourcemap/generate/uglify2.html
Install UglifyJS2 globally using npm. This is a prerequisite for using the uglifyjs command.
```bash
npm install uglify-js -g
```
--------------------------------
### Filter GET requests to example.com (<= 0.5.0)
Source: https://docs.fundebug.com/docs/notifier/wxjs/customize/filters.html
Filter HTTP requests based on URL and method using fundebug.filters.
```javascript
fundebug.filters = [
{
req:
{
url: /example\.com/,
method: /^GET$/
}
}];
```
--------------------------------
### Install fundebug-javascript via npm
Source: https://docs.fundebug.com/docs/notifier/javascript/integration/npm.html
Installs the fundebug-javascript module via npm. Use this when you prefer the standard npm registry.
```bash
npm install fundebug-javascript
```
--------------------------------
### Install fundebug-javascript via Taobao npm mirror
Source: https://docs.fundebug.com/docs/notifier/javascript/integration/npm.html
Installs fundebug-javascript using the Taobao npm mirror, which can be faster for users in China when the default npm registry is slow.
```bash
npm install fundebug-javascript --registry=https://registry.npm.taobao.org
```
--------------------------------
### userInfo object example
Source: https://docs.fundebug.com/docs/notifier/wegame/customize/setuserinfo.html
Shows the structure of the userInfo object that Fundebug can collect, including nickName, gender, city, province, and avatarUrl. This is the data that will be collected when setUserInfo is enabled.
```json
"userInfo":
{
"nickName": "Fundebug",
"gender": 1,
"city": "Xiamen",
"province": "Fujian",
"avatarUrl": "http://wx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLCBzlbOr9bJ1S4Aj1WAA2jib62y7nAFMBYhfsg2X123ibeIzQQdJvBVlUy0pibz5Xc9pKsgsvsyaHXCA/0"
}
```
--------------------------------
### Example Page data collected by getCurrentPages
Source: https://docs.fundebug.com/docs/notifier/wxjs/customize/silentpage.html
Shows the structure of Page data that Fundebug collects when silentPage is false (default). This is the data returned by getCurrentPages and includes route, __viewData__, data, __route__, and __wxWebviewId__.
```javascript
{
"route": "pages/index",
"__viewData__": {
"delBtnWidth": 51,
"goodsList": {
"list": [],
"noSelect": false,
"allSelect": true,
"totalPrice": 0,
"saveHidden": true
}
},
"data": {
"__webviewId__": 54,
"delBtnWidth": 51,
"goodsList": {
"list": [],
"noSelect": false,
"allSelect": true,
"totalPrice": 0,
"saveHidden": true
}
},
"__route__": "pages/shop-cart/index",
"__wxWebviewId__": 54
}
```
--------------------------------
### fundebug.notifyError() examples
Source: https://docs.fundebug.com/docs/notifier/wegame/api/notifyerror.html
Use fundebug.notifyError() to report caught errors. The first example sends the error object directly. The second example includes a metaData object with custom information such as company and location. The reported error type is "caught".
```javascript
try
{
// 代码
}
catch (err)
{
fundebug.notifyError(err);
}
```
```javascript
try
{
// 代码
}
catch (err)
{
fundebug.notifyError(err,
{
metaData:
{
company: "云麒",
location: "厦门"
}
});
}
```
--------------------------------
### 在 app.js 中引入并初始化 Fundebug 插件
Source: https://docs.fundebug.com/docs/notifier/aliapp/integration/index.html
在 app.js 中引入 fundebug.0.2.0.min.js 文件,并调用 fundebug.init 方法配置 apikey。注意,./libs/fundebug.0.2.0.min.js 是相对于 app.js 的路径。获取 apikey 需要免费注册 Fundebug 帐号并创建项目,注意选择对应的项目类型。
```javascript
var fundebug = require('./libs/fundebug.0.2.0.min.js')
fundebug.init(
{
apikey: "API-KEY"
})
```
--------------------------------
### Configure releasestage with init method
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/releasestage.html
Recommended way to set releasestage. Requires plugin version >= 2.0.0. Sets the stage to 'development'.
```javascript
fundebug.init({
releasestage : "development"
})
```
--------------------------------
### fundebug.init(object)
Source: https://docs.fundebug.com/docs/notifier/aliapp/api/init.html
Initializes the Fundebug client with configuration options, such as the API key. This method must be called before using other Fundebug features.
```APIDOC
## fundebug.init(object)
### Description
Initializes the Fundebug client with configuration options. Use this method to set properties such as the API key.
### Method
init
### Parameters
#### Object Parameter
- **object** (object) - Required - Configuration object containing properties to set.
- **apikey** (string) - Required - The API key for your Fundebug project.
### Request Example
```js
fundebug.init(
{
apikey: "API-KEY"
})
```
### Response
No response is returned by this method.
```
--------------------------------
### JavaScript example of fundebug.leaveBreadcrumb()
Source: https://docs.fundebug.com/docs/notifier/javascript/api/leavebreadcrumb.html
Sends a custom user behavior record with a message and page property.
```javascript
fundebug.leaveBreadcrumb({
message: "调用fetchData()接口",
page: "商品详情页面"
});
```
--------------------------------
### 在 main.js 中初始化 fundebug-wxjs
Source: https://docs.fundebug.com/docs/notifier/wxjs/framework/mpvue.html
在 main.js 中引入模块并使用 apikey 进行初始化。apikey 可通过注册 Fundebug 账号并创建对应项目获取。
```javascript
var fundebug = require("fundebug-wxjs");
fundebug.init({
apikey: "apikey"
});
```
--------------------------------
### Install fundebug-reactnative module
Source: https://docs.fundebug.com/docs/notifier/reactnative/integration/index.html
Run this command in your terminal to add the Fundebug React Native dependency to your project.
```bash
npm install --save fundebug-reactnative
```
--------------------------------
### Configure filters with fundebug.init
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/filters.html
Recommended way to configure filters using the init method. Requires plugin version >= 2.0.0.
```javascript
fundebug.init({
filters : [
{
message: /^Script error\.$/
}
]
})
```
--------------------------------
### Configure appversion with fundebug.init
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/appversion.html
Recommended way to set the application version. Requires plugin version >= 2.0.0.
```JavaScript
fundebug.init({
appversion: "3.2.5"
})
```
--------------------------------
### Example error event JSON
Source: https://docs.fundebug.com/docs/notifier/wxjs/customize/filters.html
The structure of an error event captured by Fundebug, visible in the network request body.
```json
{
"notifierVersion": "0.4.0",
"systemInfo":
{
"errMsg": "getSystemInfo:ok",
"model": "iPhone 5",
"pixelRatio": 2,
"windowWidth": 320,
"windowHeight": 504,
"system": "iOS 10.0.1",
"language": "zh_CN",
"version": "6.6.3",
"screenWidth": 320,
"screenHeight": 568,
"SDKVersion": "1.9.91",
"brand": "devtools",
"fontSizeSetting": 16,
"benchmarkLevel": 1,
"batteryLevel": 100,
"statusBarHeight": 20,
"platform": "devtools"
},
"apikey": "0abbf8337ed309d1e0337ab47a4e904d2ed2a30fcc18d22efd807f190192e24c",
"releaseStage": "production",
"metaData":
{
"tier": "free"
},
"breadcrumbs": [
{
"type": "function",
"time": 1527556801032,
"belong": "App",
"method": "onLaunch",
"path": "pages/start/start",
"query":
{},
"scene": 1001
},
{
"type": "function",
"time": 1527556801328,
"belong": "App",
"method": "onShow",
"path": "pages/start/start",
"query":
{},
"scene": 1001
}],
"time": 1527556801343,
"error": "thirdScriptError\nTEST 01;at App lifeCycleMethod onLaunch function\nError: TEST 01\n at e.onLaunch (http://127.0.0.1:52992/appservice/app.js:19:15)\n at e._0x4c25b0.(anonymous function) (http://127.0.0.1:52992/appservice/release/fundebug.0.3.1.min.js:192:78)\n at e.o (http://127.0.0.1:52992/appservice/__dev__/WAService.js:18:19145)\n at new e (http://127.0.0.1:52992/appservice/__dev__/WAService.js:18:20499)\n at Function. (http://127.0.0.1:52992/appservice/__dev__/WAService.js:18:20988)\n at http://127.0.0.1:52992/appservice/__dev__/WAService.js:17:31961\n at Object._0x27d8dc.(anonymous function) [as bipMe] (http://127.0.0.1:52992/appservice/release/fundebug.0.3.1.min.js:113:12)\n at App (http://127.0.0.1:52992/appservice/release/fundebug.0.3.1.min.js:358:37)\n at http://127.0.0.1:52992/appservice/app.js:16:1\n at require (http://127.0.0.1:52992/appservice/__dev__/WAService.js:18:26712)",
"type": "uncaught",
"scene": 1001
};
```
--------------------------------
### Configure domain via init method (JavaScript)
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/domain.html
Use the `init` method to set the `domain` option. This is the recommended way for plugin versions >= 2.0.0. Replace `YOUR-SUB-DOMAIN` with the actual sub-path.
```javascript
fundebug.init({
domain: "YOUR-SUB-DOMAIN"
})
```
--------------------------------
### Initialize Fundebug with appVersion
Source: https://docs.fundebug.com/docs/notifier/aliapp/customize/appversion.html
Use the appVersion property within the fundebug.init configuration object to define the current version of your AliPay Mini Program.
```javascript
fundebug.init(
{
appVersion: "3.2.5"
})
```
--------------------------------
### Filter HTTP errors by method and status
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/filters.html
Filters errors where the request method is GET and the response status is 401.
```javascript
fundebug.filters = [
{
req: {
method: /^GET$/
},
res: {
status: /^401$/
}
}
];
```
--------------------------------
### Configure silentResource variable in JavaScript
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/silentresource.html
Sets the global fundebug.silentResource property directly. This example checks if Fundebug is loaded and then disables resource monitoring.
```javascript
if ("fundebug" in window) {
fundebug.silentResource = true;
}
```
--------------------------------
### 在 app.js 中引入并配置 Fundebug 插件
Source: https://docs.fundebug.com/docs/notifier/wxjs/integration/index.html
在 app.js 中引入下载的 Fundebug 插件文件,并调用 init 方法配置 apikey。注意,./libs/fundebug.1.7.2.min.js 是相对于 app.js 的路径,apikey 需要免费注册账号并创建项目后获取。
```javascript
var fundebug = require("./libs/fundebug.1.7.2.min.js");
fundebug.init({
apikey: "API-KEY"
});
```
--------------------------------
### Location object structure
Source: https://docs.fundebug.com/docs/notifier/aliapp/customize/setlocation.html
Example of the location object that Fundebug collects when setLocation is enabled. Contains country, province, city, and district fields.
```json
{
"country": "中国",
"province": "浙江省",
"city": "杭州市",
"district": "西湖区"
}
```
--------------------------------
### main.js 导入 config.js 和 test.js
Source: https://docs.fundebug.com/docs/notifier/javascript/other/import_cause_fundebug_apikey_error.html
展示 main.js 中导入 config.js 和 test.js 以规避 import 提升问题。
```javascript
// main.js
import * as fundebug from "fundebug-javascript";
import "./config";
import "./test";
```
--------------------------------
### Configure metaData with fundebug.init
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/metadata.html
Recommended way to set metaData. Requires plugin version >= 2.0.0. The metaData object is passed to the init method.
```javascript
fundebug.init({
metaData : {
company:
{
name: "Fundebug",
nation: "China"
}
}
})
```
--------------------------------
### Example error event JSON
Source: https://docs.fundebug.com/docs/notifier/aliapp/customize/filters.html
Shows the structure of an error event that could be filtered, including properties like notifierVersion, apikey, message, and stack.
```json
{
"notifierVersion": "0.0.0",
"apikey": "e9c3a22f94a5f757b4608edd2e87f3ae085a447ee2bde4d1446aa9871ea3ac95",
"appVersion": "0.1.0",
"releaseStage": "development",
"metaData": {
"name": "test"
},
"breadcrumbs": [
{
"type": "console",
"time": 1531293322820,
"method": "log",
"args": {
"0": "Running application \"main\" with appParams: {\"rootTag\":1,\"initialProps\":{\"exp\":{\"manifest\":{\"description\":\"This project is really great.\",\"developer\":{\"projectRoot\":\"/Users/kiwenlau/Desktop/Fundebug/reactnative-notifier\",\"tool\":\"xde\"},\"loadedFromCache\":false,\"orientation\":\"portrait\",\"env\":{},\"platforms\":[\"ios\",\"android\"],\"xde\":true,\"id\":\"@kiwenlau/reactnative-notifier\",\"hostUri\":\"localhost:19000\",\"iconUrl\":\"http://localhost:19001/assets/./assets/icon.png\",\"assetBundlePatterns\":[\"**/*\"],\"mainModuleName\":\"node_modules/expo/AppEntry\",\"sdkVersion\":\"28.0.0\",\"isVerified\":true,\"packagerOpts\":{\"lanType\":\"ip\",\"dev\":true,\"minify\":false,\"urlRandomness\":\"3p-hmx\",\"hostType\":\"tunnel\"},\"ios\":{\"supportsTablet\":true},\"updates\":{\"fallbackToCacheTimeout\":0},\"bundleUrl\":\"http://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fkiwenlau%2FDesktop%2FFundebug%2Freactnative-notifier%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles\",\"version\":\"1.0.0\",\"debuggerHost\":\"localhost:19001\",\"icon\":\"./assets/icon.png\",\"slug\":\"reactnative-notifier\",\"name\":\"reactnative-notifier\",\"privacy\":\"public\",\"logUrl\":\"http://localhost:19000/logs\",\"splash\":{\"resizeMode\":\"contain\",\"image\":\"./assets/splash.png\",\"backgroundColor\":\"#ffffff\",\"imageUrl\":\"http://localhost:19001/assets/./assets/splash.png\"}},\"initialUri\":\"exp://localhost:19000\",\"appOwnership\":\"expo\",\"shell\":0}}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF"
}
}
],
"time": 1531293323868,
"type": "uncaught",
"name": "TypeError",
"message": "undefined is not an object (evaluating 'b.c')",
"line": 115833,
"column": 34,
"stack": "http://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fkiwenlau%2FDesktop%2FFundebug%2Freactnative-notifier%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles:115833:34\n_callTimer@http://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fkiwenlau%2FDesktop%2FFundebug%2Freactnative-notifier%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles:3115:17\ncallTimers@http://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fkiwenlau%2FDesktop%2FFundebug%2Freactnative-notifier%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles:3322:19\n__callFunction@http://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fkiwenlau%2FDesktop%2FFundebug%2Freactnative-notifier%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles:2726:49\nhttp://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fkiwenlau%2FDesktop%2FFundebug%2Freactnative-notifier%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles:2496:31\n__guardSafe@http://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fkiwenlau%2FDesktop%2FFundebug%2Freactnative-notifier%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles:2688:13\ncallFunctionReturnFlushedQueue@http://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fkiwenlau%2FDesktop%2FFundebug%2Freactnative-notifier%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles:2495:21\ncallFunctionReturnFlushedQueue@[native code]",
"sourceURL": "http://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2Fkiwenlau%2FDesktop%2FFundebug%2Freactnative-notifier%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles",
"isFatal": true
}
```
--------------------------------
### Initialize fundebug-wxjs with apikey
Source: https://docs.fundebug.com/docs/notifier/wxjs/integration/npm.html
Initializes Fundebug in your mpvue or WePY mini program. Replace "API-KEY" with your actual apikey, which you obtain by registering an account and creating a project with the correct project type.
```js
var fundebug = require("fundebug-wxjs");
fundebug.init({
apikey: "API-KEY"
});
```
--------------------------------
### Initialize Fundebug with apikey
Source: https://docs.fundebug.com/docs/notifier/aliapp/customize/apikey.html
Initializes Fundebug with your project's apikey. Replace "API-KEY" with the actual key obtained from the Fundebug dashboard after creating a project of the matching type.
```javascript
fundebug.init(
{
apikey: "API-KEY"
})
```
--------------------------------
### Configure apikey in HTML script tag
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/apikey.html
Set the apikey attribute directly on the Fundebug script tag. The example uses version 2.8.6 of the script.
```HTML
```
--------------------------------
### Configure properties with fundebug.set
Source: https://docs.fundebug.com/docs/notifier/wxjs/api/set.html
Example of setting the silent property to true using fundebug.set(). This method is supported in plugin version 1.5.0 and above, but cannot be used to change the apikey.
```javascript
fundebug.set({
silent: true
});
```
--------------------------------
### Configure sampleRate via init method
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/samplerate.html
Use the init method to set sampleRate to 0.3, collecting 30% of errors. Supported in plugin versions >= 2.0.0.
```JavaScript
fundebug.init({
sampleRate : 0.3
})
```
--------------------------------
### Fundebug unhandledrejection error data
Source: https://docs.fundebug.com/docs/notifier/javascript/type/unhandledrejection.html
Example error data captured by the Fundebug plugin for an unhandledrejection, showing fields like name, type, message, and time.
```json
{
"notifierVersion": "1.5.1",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
"locale": "zh-CN",
"url": "http://localhost:3001",
"title": "TEST",
"releaseStage": null,
"name": "unhandledrejection",
"time": 1546521929451,
"message": "hello",
"type": "unhandledrejection"
}
```
--------------------------------
### Apache配置:仅允许Fundebug IP访问.map文件
Source: https://docs.fundebug.com/docs/notifier/javascript/sourcemap/download.html
使用FilesMatch指令匹配.map文件,通过Order、Deny和Allow指令限制访问,仅允许Fundebug的IP地址。
```apache
Order deny,allow
Deny from all
Allow from 120.77.45.162
Allow from 120.79.16.115
```
--------------------------------
### Configure methodBlacklist with fundebug.init()
Source: https://docs.fundebug.com/docs/notifier/wxjs/customize/methodblacklist.html
Configure the methodBlacklist option in the fundebug.init() call to exclude specific custom functions from monitoring. Requires plugin version >= 0.6.1.
```javascript
fundebug.init(
{
methodBlacklist : ["foo", "bar"]
})
```
--------------------------------
### Example Page Data Collected by getCurrentPages
Source: https://docs.fundebug.com/docs/notifier/aliapp/customize/silentpage.html
Shows the JSON structure returned by getCurrentPages when silentPage is false (default). Contains route, _viewId, and data fields.
```json
{
"route": "pages/index/index",
"_viewId": "1556021552987",
"data": {
"title": "Alipay"
}
}
```
--------------------------------
### Location data structure example
Source: https://docs.fundebug.com/docs/notifier/wegame/customize/setlocation.html
Shows the JSON structure of the location object that Fundebug collects when setLocation is true. It includes latitude, longitude, speed, and altitude fields.
```json
"location" : {
"latitude" : 24.57591,
"longitude" : 118.09728,
"speed" : -1,
"altitude" : 0
}
```
--------------------------------
### Configure apikey using init method
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/apikey.html
Recommended for plugin version >= 2.0.0. Call fundebug.init with the apikey property set to your API key.
```JavaScript
fundebug.init({
apikey: "API-KEY",
});
```
--------------------------------
### Configure maxRevideoSizeInByte via init method
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/maxRevideoSizeInByte.html
Use this snippet to set the maximum recording size to 300KB via the init method. This is the recommended way for plugin versions >= 2.0.0.
```javascript
fundebug.init({
maxRevideoSizeInByte: "300"
})
```
--------------------------------
### Set silentConsole in HTML script tag
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/silentconsole.html
Configure silentConsole as an attribute in the Fundebug script tag. This example uses version 2.8.6 and includes apikey and crossorigin attributes.
```HTML
```
--------------------------------
### Configure releasestage in HTML script tag
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/releasestage.html
Sets releasestage as an attribute on the Fundebug script tag. The example uses version 2.8.6 and includes apikey and crossorigin attributes.
```html
```
--------------------------------
### 使用淘宝 NPM 镜像安装 fundebug-cli
Source: https://docs.fundebug.com/docs/notifier/javascript/sourcemap/upload/cli.html
当国外 NPM 速度较慢时,可使用淘宝镜像安装 fundebug-cli。
```bash
npm install fundebug-cli -g --registry=https://registry.npm.taobao.org
```
--------------------------------
### Report HTTP error with wx.request and notifyHttpError
Source: https://docs.fundebug.com/docs/notifier/wxjs/api/notifyhttperror.html
Example of using wx.request and calling fundebug.notifyHttpError in both success and fail callbacks to report the request and response. The error type reported is 'httpError'.
```javascript
wx.request({
method: "POST",
url: "https://example.com/create",
data: {
test: "test"
},
success(res) {
fundebug.notifyHttpError(
{
method: "POST",
url: "https://example.com/create"
},
res
);
},
fail(res) {
fundebug.notifyHttpError(
{
method: "POST",
url: "https://example.com/create"
},
res
);
}
});
```
--------------------------------
### 在 game.js 中引入并配置 Fundebug 插件
Source: https://docs.fundebug.com/docs/notifier/wegame/integration.html
在微信小游戏的入口文件 game.js 中引入本地插件文件并调用 fundebug.init 配置 apikey。apikey 需要免费注册账号并创建项目,项目类型选择“微信小游戏”。
```javascript
var fundebug = require('./libs/fundebug.0.5.0.min.js')
fundebug.init({
apikey: "API-KEY"
});
```
--------------------------------
### 开启安静模式:fundebug.init({ silent: true })
Source: https://docs.fundebug.com/docs/notifier/aliapp/customize/silent.html
在开发阶段,将 silent 属性设为 true 以开启安静模式,避免过多错误报警。当 silent 为 true 时,Fundebug 不再收集任何错误。
```javascript
fundebug.init({
silent: true
});
```
--------------------------------
### Configure silentDev in HTML script tag
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/silentdev.html
Set the silentDev attribute to true in the Fundebug script tag. The example uses version 2.8.6 and includes apikey and crossorigin attributes.
```HTML
```
--------------------------------
### Configure metaData with company information
Source: https://docs.fundebug.com/docs/notifier/aliapp/customize/metadata.html
Use this snippet to set custom metadata via the metaData option in fundebug.init. The example includes a company object with name and nation fields.
```javascript
fundebug.init(
{
metaData:
{
company:
{
name: "Fundebug",
nation: "China"
}
}
})
```
--------------------------------
### Configure silentResource with fundebug.init()
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/silentresource.html
Recommended way to enable silentResource. Set the property to true to stop monitoring resource loading errors. Requires the Fundebug plugin version 2.0.0 or later.
```javascript
fundebug.init({
silentResource: true
});
```
--------------------------------
### 使用 init 方法配置 user
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/user.html
推荐使用 init 方法配置 user 对象,需要插件版本 >= 2.0.0。
```javascript
fundebug.init({
user: {
name: "fundebug",
email: "help@fundebug.com"
}
});
```
--------------------------------
### Enable monitorResponse in fundebug.init
Source: https://docs.fundebug.com/docs/notifier/wxjs/customize/monitorresponse.html
Set monitorResponse to true within the fundebug.init configuration to start collecting HTTP response bodies. This feature is available in plugin versions 1.6.0 and later.
```javascript
fundebug.init({
monitorResponse: true
});
```
--------------------------------
### Enable setSystemInfo in Fundebug init
Source: https://docs.fundebug.com/docs/notifier/aliapp/customize/setsysteminfo.html
Enable collection of systemInfo by setting setSystemInfo to true in the Fundebug init configuration. By default, Fundebug does not collect systemInfo to protect user privacy.
```javascript
fundebug.init({
setSystemInfo: true
});
```
--------------------------------
### import 提升后的实际执行顺序
Source: https://docs.fundebug.com/docs/notifier/javascript/other/import_cause_fundebug_apikey_error.html
展示 import 提升后 main.js 的实际执行顺序。
```javascript
// main.js
import * as fundebug from "fundebug-javascript";
import "./test";
fundebug.init({
apikey: "API-KEY"
})
```
--------------------------------
### Configure silentPromise in HTML script tag
Source: https://docs.fundebug.com/docs/notifier/javascript/customize/silentpromise.html
Set the silentPromise attribute in the Fundebug script tag to disable Promise error monitoring. Note the example uses silentPerformance instead of silentPromise, which may be a typo in the source.
```html
```
--------------------------------
### main.js 导入配置和 test.js
Source: https://docs.fundebug.com/docs/notifier/javascript/other/import_cause_fundebug_apikey_error.html
展示 main.js 中导入 fundebug 并配置 apikey,然后导入 test.js。
```javascript
// main.js
import * as fundebug from "fundebug-javascript";
fundebug.init({
apikey: "API-KEY"
})
import "./test";
```
--------------------------------
### 安装 fundebug-cli(npm)
Source: https://docs.fundebug.com/docs/notifier/javascript/sourcemap/upload/cli.html
使用 npm 全局安装 fundebug-cli。需要先安装 Node.js。
```bash
npm install fundebug-cli -g
```
--------------------------------
### Fundebug WebSocket error data
Source: https://docs.fundebug.com/docs/notifier/javascript/type/websocket.html
Example error data captured by the Fundebug plugin for a WebSocket connection error. The data includes notifier version, user agent, locale, URL, title, release stage, time, type, and target details.
```javascript
{
"notifierVersion": "1.5.1",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
"locale": "zh-CN",
"url": "http://localhost:3001",
"title": "TEST",
"releaseStage": null,
"time": 1546522748886,
"type": "websocketError",
"target": {
"type": "onerror",
"url": "wss://ap.fundebug.com/api/events/count",
"timeStamp": 835.6999999959953
}
}
```
--------------------------------
### Delete Source Map with Node.js POST request
Source: https://docs.fundebug.com/docs/notifier/javascript/sourcemap/delete/api.html
Node.js example for deleting Source Maps via the Fundebug API. Sends a POST request to /javascript/sourcemap/clear with an apikey in the JSON body. Requires the request-promise package and a valid apikey obtained by registering and creating a project.
```javascript
const request = require("request-promise");
const fs = require("fs");
const options = {
method: "POST",
uri: "https://fundebug.com/javascript/sourcemap/clear",
body: {
apikey: "YOUR-API-KEY"
},
json: true
};
request(options)
.then(function(success) {
console.log("success:", success);
})
.catch(function(err) {
console.log("fail:", err);
});
```