# multiappacitive

> Allows you to integrate applications built using javascript with the Appacitive platform overriding singleton behaviour.

Latest version **0.1.2** (published 2014-04-25) · 0 weekly downloads

## Install

```sh
npm install multiappacitive
pnpm add multiappacitive
yarn add multiappacitive
bun add multiappacitive
```

## 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.1.2 |
| Published | 2014-04-25 |
| First published | 2014-01-10 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Chirag Sanghvi |
| Maintainers | chiragsanghvi |
| Keywords | Appacitive, javascript, multi, BAAS, cloud, api |

## Links

- npm: https://www.npmjs.com/package/multiappacitive
- Repository: https://github.com/chiragsanghvi/multiAppacitive
- Issues: https://github.com/chiragsanghvi/multiAppacitive/issues
- npm.io page: https://npm.io/package/multiappacitive

## Dependencies (1)

- [appacitive](https://npm.io/package/appacitive.md) x.x.x

## Recent versions

- 0.1.2 (latest) — 2014-04-25
- 0.1.1 — 2014-01-10
- 0.1.0 — 2014-01-10

## README

This module returns a new instance of the Appacitive Javascript SDK on every include, overriding the default Singleton-like behaviour. This is achieved by clearing node's require.cache of the Appacitive module.

```javascript
npm install multiappacitive
```
**Usage**
```javascript
//Include multiAppacitive
var multiAppacitive = require('multiappacitive').Appacitive;

//Get a new instance of Appacitive
var Appacitive = new multiAppacitive();

//Get another new instance of Appacitive
var otherAppacitive = new multiAppacitive();
```

After getting a new instance, you need to intialize the SDK, as we do for normal singleton behaviour.

**Example**

The only place where we may need to change the singleton behaviour of SDK is performing actions on behalf of a loggged-in user, using his user-token. 

*export.js*
```javascript
// This script will be used to setup Appacitive usertoken in the SDK, if supplied, and return a new instance of Appacitive.
// If you provide a user object then that object will be set as current user. 
// You can always fetch a user by his token and set it as current user afterwards.

var multiAppacitive = require('multiappacitive').Appacitive;

exports.init = function (userToken, user) {
        
        var Appacitive = new multiAppacitive();
        
        Appacitive.initialize({ 
            apikey: {apikey}, 
            env: "{env}",
            appId: "{appId}",
            userToken: userToken, 
            user: user
        });

        return Appacitive;
};

```

*sample.js*
```javascript
var app = require('./exports.js');

var userToken = "{usertoken}";

var Appacitive = app.init(userToken);	
```

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