microlink-function

0.0.0 • Public • Published

JavaScript runtime functions made simple.

Install

$ npm install @microlink/function --save

Usage

Interact with the page

const microlinkFunction = require('@microlink/function')

const fn = microlinkFunction(({ page }) => page.title())

const result = await fn('https://google.com')

console.log(result)
// {
//   isFulfilled: true,
//   isRejected: false,
//   value: 'Google'
// }

Interact with the response

const microlinkFunction = require('@microlink/function')

const fn = microlinkFunction(({ page }) => response.status())

const result = await fn('https://google.com')

console.log(result)
// {
//   isFulfilled: true,
//   isRejected: false,
//   value: 200
// }

Interact with the query

const microlinkFunction = require('@microlink/function')

const fn = microlinkFunction(({ query }) => query.greetings)

const result = await fn('https://google.com', { greetings: 'hello world' })

console.log(result)
// {
//   isFulfilled: true,
//   isRejected: false,
//   value: 'hello world'
// }

API

microlinkFunction(fn, [mqlOpts], [gotoOpts])

fn

Required
Type: string

The function that be executed inside Microlink API browser.

mqlOpts

Type: object

The function that be executed inside Microlink API browser.

Any option passed here will bypass to mql.

gotoOpts

Type: object

Any option passed here will bypass to browserless#goto.

License

microlink-function © , released under the MIT License.
Authored and maintained by with help from contributors.

· GitHub · Twitter @microlink

Package Sidebar

Install

npm i microlink-function

Weekly Downloads

0

Version

0.0.0

License

MIT

Unpacked Size

5.97 kB

Total Files

4

Last publish

Collaborators

  • kikobeats