-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.js
43 lines (37 loc) · 1003 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* @file example
* @author imcuttle <moyuyc95@gmail.com>
* @date 2018/11/7
*
*/
const reporterRender = require('./standalone')
require('./standalone.less')
const newGitHubIssue = require('new-github-issue-url')
const reporter = reporterRender(window.root, { shouldCopy: true, shouldOpenUrlInSameWindow: true })
reporter.setProps({
onAfterText(text, env) {
Object.assign(env, {
$openUrl: newGitHubIssue({
title: 'Bug: emmm',
user: 'be-fe',
repo: 'issue-reporter-web',
body: "\n\n\n---\nI'm a human. Please be nice.\n\n" + text
})
})
}
})
// Way 2:
// reporter.call('hooks.on', [
// 'text', ({ env, text }) => {
// Object.assign(env, {
// $openUrl: newGitHubIssue({
// title: 'Bug: emmm',
// user: 'be-fe',
// repo: 'issue-reporter-web',
// body: '\n\n\n---\nI\'m a human. Please be nice.\n\n' + text
// })
// })
// }
// ])
// Make latest mistake
throw new Error('Make mistake')