New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

patch-profile

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

patch-profile

A simple profile editing page for patch-* family apps

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

Patch-profile

A module for editing your (or other people's) profiles in patch-* family apps. Edits names or images.

You'll need to understand depject (a module for a different way of managing dependency injection), and for hte example below, depnest - a lazy way to write nested objects quickly.

Example

const nest = require('depnest')
const { h } = require('mutant')

exports.gives = nest('app.page.userEdit')

exports.needs = nest({
  'about.page.edit': 'first',
  'history.sync.push': 'first',
})

exports.create = (api) => {
  return nest('app.page.userEdit', userEdit)

  function userEdit (location) {
    // location is an object { feed, page: 'userEdit' } 

    const options = { feed: location.feed }
    const callback = (err, didEdit) => {
      if (err) throw new Error ('Error editing profile', err) 

      if (didEdit) console.log('Profile updated!')
      // go back to the users profile
      api.history.sync.push({ page: 'userShow', feed })
    }

    return h('Page -userEdit', {}, [
      h('div.container', [
        api.about.page.edit(options, callback)
      ])
    ])
  }
}

API

about.page.edit

(options=object, callback=function)

Where target is of the form { feed='@....', labels=object }

labels (optional) can be used to over-ride labels for translations: { name, image, cancel, save } callback (optional) will be called after a user confirms or cancels changes. It has signature (err, didEdit=boolean), where didEdit == true if an edit was published.

styles.mcss

Patch-profile exports basic mcss styles. See Patchbay for examples of how this can be integrated into an app.

Keywords

patchcore

FAQs

Package last updated on 24 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts