You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@teamthread/elm-web-components

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teamthread/elm-web-components - npm Package Compare versions

Comparing version

to
0.3.0

8

lib/index.js

@@ -20,3 +20,5 @@ // adapted from https://github.com/PixelsCommander/ReactiveElements

_ref$staticFlags = _ref.staticFlags,
staticFlags = _ref$staticFlags === void 0 ? {} : _ref$staticFlags;
staticFlags = _ref$staticFlags === void 0 ? {} : _ref$staticFlags,
_ref$onDetached = _ref.onDetached,
onDetached = _ref$onDetached === void 0 ? function () {} : _ref$onDetached;

@@ -32,2 +34,6 @@ var elementPrototype = Object.create(HTMLElement.prototype);

elementPrototype.detachedCallback = function () {
onDetached();
};
document.registerElement(name, {

@@ -34,0 +40,0 @@ prototype: elementPrototype

2

package.json
{
"name": "@teamthread/elm-web-components",
"version": "0.2.0",
"version": "0.3.0",
"description": "Run your Elm apps through web components.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -103,4 +103,21 @@ # elm-web-components

Will end up with the Elm component having two flags: `someCustomProp` and `name`.
## `onDetached` (new in 0.3.0)
If you need to do some work when the Elm component is removed from the DOM, you can now pass `onDetached: () => ...` as another option:
```js
elmWebComponents.register('component-with-ports', ComponentWithPorts, {
setupPorts: ports => {},
staticFlags: {
someCustomProp: 'foo',
},
onDetached: () => {
console.log('Called when the component is removed from the DOM')
}
})
```
This is useful for tidying up any event listeners you might have.
## Examples

@@ -112,2 +129,6 @@

**v0.3.0** [3 May 2018]
* You can now pass `onDetached` as an option. This is a callback function that will be run when component is removed from the DOM.
**v0.2.0** [1 May 2018]

@@ -114,0 +135,0 @@