Installations
npm install observable-mixin
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
7.4.0
NPM Version
4.0.5
Score
66.7
Supply Chain
95.1
Quality
75
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
ziflex
Download Statistics
Total Downloads
800
Last Day
1
Last Week
1
Last Month
3
Last Year
50
GitHub Statistics
2 Commits
2 Watching
1 Branches
1 Contributors
Bundle Size
372.00 B
Minified
247.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.0.0
Package Id
observable-mixin@1.0.0
Size
28.34 kB
NPM Version
4.0.5
Node Version
7.4.0
Publised On
10 Jan 2017
Total Downloads
Cumulative downloads
Total Downloads
800
Last day
0%
1
Compared to previous day
Last week
-50%
1
Compared to previous week
Last month
200%
3
Compared to previous month
Last year
-26.5%
50
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
observable-mixin
Just observe
Mixin that makes your types observable without exposing emitter.
1 npm install --save observable-mixin
Usage
observable-mixin
brings 1 method:
subscribe(eventName: String, handler: Function, [once: Boolean]): Function
returns a function that unsubscribes a given listener
The mixin comes as a factory function i.e. in order to get mixin it needs to invoke exported function. It is done intentionally in order to be able to pass any kind of implementation of EventEmitter.
1 2 import Symbol from 'es6-symbol'; 3 import composeClass from 'compose-class'; 4 import ObservableMixin from 'observable-mixin'; 5 import { EventEmitter } from 'events'; 6 7 const FIELDS = { 8 emitter: Symbol('emitter'), 9 name: Symbol('name') 10 }; 11 12 const Person = composeClass({ 13 mixins: [ 14 ObservableMixin(FIELDS.emitter) 15 ], 16 17 constructor(name) { 18 this[FIELDS.emitter] = new EventEmitter(); 19 this[FIELDS.name] = name; 20 }, 21 22 name(value) { 23 if (value) { 24 this[FIELDS.name] = value; 25 this[FIELDS.emitter].emit('change', 'name', value); 26 } 27 28 return this[FIELDS.name]; 29 } 30 }); 31
1import Person from './person'; 2 3const person = new Person('Mike Wazowski'); 4 5const unsubscribe = person.subscribe('change', (field, value) => { 6 console.log('Person\'s', field, 'was changed to', value); 7}); 8 9person.name('James P. Sullivan'); // Person's name was changed to 'James P. Sullivan' 10 11unsubscribe(); 12 13person.name('Randall Boggs'); // Nothing 14
Mixin supports once
subscription:
1import Person from './person'; 2 3const person = new Person('Mike Wazowski'); 4 5person.subscribe('change', (field, value) => { 6 console.log('Person\'s', field, 'was changed to', value); 7}, true); 8 9person.name('James P. Sullivan'); // Person's name was changed to 'James P. Sullivan' 10 11person.name('Randall Boggs'); // Nothing 12
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/2 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
67 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-pp7h-53gx-mx7r
- Warn: Project is vulnerable to: GHSA-832h-xg76-4gv6
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-hr2v-3952-633q
- Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9
- Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h
- Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2
- Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3
- Warn: Project is vulnerable to: MAL-2023-462
- Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c
- Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq
- Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6
- Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq
- Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm
- Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-4hpf-3wq7-5rpr
- Warn: Project is vulnerable to: GHSA-f522-ffg8-j8r6
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q
- Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-gqgv-6jq5-jjj9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
- Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3
- Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7
- Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-xc7v-wxcw-j472
Score
1.7
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to observable-mixin
can-observable-mixin
Define properties on JavaScript classes
react-observable-mixin
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.
observable-properties-mixin
Features to generate observable properties mixin
with-observable
Lightweight observable mixin