# voxel-share

> Take a snapshot of voxel.js and share on imgur/twitter

Latest version **0.3.0** (published 2013-04-03) · 0 weekly downloads

## Install

```sh
npm install voxel-share
pnpm add voxel-share
yarn add voxel-share
bun add voxel-share
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2013-04-03 |
| First published | 2013-01-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Kyle Robinson Young |
| Maintainers | shama |
| Keywords | voxel, share, imgur, twitter |

## Links

- npm: https://www.npmjs.com/package/voxel-share
- Repository: https://github.com/shama/voxel-share
- Issues: https://github.com/shama/voxel-share/issues
- npm.io page: https://npm.io/package/voxel-share

## Recent versions

- 0.3.0 (latest) — 2013-04-03
- 0.2.0 — 2013-03-23
- 0.1.0 — 2013-01-29

## README

# voxel-share

Take a snapshot in [voxel.js](https://github.com/maxogden/voxel-engine) and
share on imgur.com/twitter.com.

Props to [imgur.com](http://imgur.com) for enabling CORS and accepting base64
image uploads via the browser. :D

[View this example](http://shama.github.com/voxel-share)

# usage

Create a share tool:

```js
var share = require('voxel-share')({
  // pass a copy of the game
  game: game,

  // api key from https://api.imgur.com/oauth2/addclient
  key: 'abcd1234',

  // specify a message to set as caption/tweet
  message: 'Greetings from voxel.js! @voxeljs',

  // type of image: image/png or image/jpg
  type: 'image/png',

  // quality of image. between 0 and 1
  quality: 0.75,

  // do something else with the image link after it's uploaded
  afterUpload: function(imageLink) {
    // Open the tweet dialog with image link
    this.tweet(imageLink);
  },
});
```

Then upon desired event, open/close the share dialog:

```js
window.addEventListener('keyup', function(e) {

  // on enter, open dialog
  if (e.keyCode === 13) share.open();

  // on esc, close dialog
  if (e.keyCode === 27) share.close();

});
```

Check
[the example](https://github.com/shama/voxel-share/tree/master/example/world.js)
for a more in-depth usage.

# install

With [npm](https://npmjs.org) do:

```
npm install voxel-share
```

Use [browserify](http://browserify.org) to `require('voxel-share')`.

## release history
* 0.3.0 - Added afterUpload feature. Thanks @maxogden!
* 0.2.0 - update to work with imgur api v3. Thanks @maxogden!
* 0.1.0 - initial release

## license
Copyright (c) 2013 Kyle Robinson Young<br/>
Licensed under the MIT license.

---
_Source: https://npm.io/package/voxel-share · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
