Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0 异步插件 #9

Open
1 task
zswang opened this issue Sep 30, 2017 · 0 comments
Open
1 task

v3.0 异步插件 #9

zswang opened this issue Sep 30, 2017 · 0 comments
Milestone

Comments

@zswang
Copy link
Owner

zswang commented Sep 30, 2017

异步插件

  • 异步处理
<!--jdists export="#translate"-->
function (content) {
  var request = require('request')
  return new Promise(function (resolve, reject) {
     request.post({
        url: 'https://xxx.com/translate',
        body: content,
     }, function (err, req, body) {
       if (err) {
          reject(err)
       } else {
         resolve(body)
       }
     })
  })
}
<!--/jdists-->

<!--jdists encoding="#translate"-->
Hello world!
<!--/jdists-->
@zswang zswang added this to the 3.0 milestone Sep 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant