# gardr-plugin-ext-postscribe

> Gardr plugin for requesting replacement with Postscribe from inside of an iframe

Latest version **0.2.2** (published 2014-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install gardr-plugin-ext-postscribe
pnpm add gardr-plugin-ext-postscribe
yarn add gardr-plugin-ext-postscribe
bun add gardr-plugin-ext-postscribe
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2014-11-26 |
| First published | 2014-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Krystian Jarmicki |
| Maintainers | kjarmicki |
| Keywords | gardr, gardr-plugin, postscribe |

## Links

- npm: https://www.npmjs.com/package/gardr-plugin-ext-postscribe
- npm.io page: https://npm.io/package/gardr-plugin-ext-postscribe

## Dependencies (2)

- [gardr-core-plugin](https://npm.io/package/gardr-core-plugin.md) 0.0.1
- [cross-domain-events](https://npm.io/package/cross-domain-events.md) ^0.0.2

## Recent versions

- 0.2.2 (latest) — 2014-11-26
- 0.2.1 — 2014-11-25
- 0.1.1 — 2014-11-17
- 0.1.0 — 2014-09-29

## README

# Gardr Postscribe Plugin (Ext)

Gardr plugin to enable content rendering with [Postscribe](https://github.com/krux/postscribe) from inside of an iframe.
It sends message to parent window which sould be caught [gardr-plugin-host-postscribe](https://github.com/Schibsted-Tech-Polska/gardr-plugin-host-postscribe).


## Install

```
npm install gardr-plugin-ext-postscribe --save
```

## Bundle

In your ext bundle file:
```javascript
    var gardrExt = require('gardr-ext');
    var postscribe = require('gardr-plugin-ext-postscribe');

    gardrExt.plugin(postscribe);

    module.exports = gardrExt;
```

## Usage

Set global variable ```_gardrPostscribe``` to ```true``` anywhere in script pointed by options.url or declare a custom function: 
```javascript
_gardrRunPostscribe = function(getHTML) { 
    _gardrRunPostscribe.getHTML = getHTML
}```

In host window:
```javascript
var gardr = gardrHost(...);
gardr.queue('ad', {
    url: 'my-adserver.com/ad.js',
    ...
});
```

In my-adserver.com/ad.js:
```javascript
window._gardrPostscribe = true;
```
or
```javascript
window._gardrRunPostscribe(function() {
    return '<script src="http://www.url.to.ad"></script>';
});
```

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