Skip to content

Commit

Permalink
Merge pull request #3 from t0w5a/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
t0w5a authored May 21, 2017
2 parents 2b3760d + 22736aa commit 7d6f2c9
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,4 @@ events and the Subjects attached to them.
[https://github.com/t0w5a/rx-pubsub](https://github.com/t0w5a/rx-pubsub)

### <a name="version"></a>6. Version
0.0.7
0.0.8
8 changes: 4 additions & 4 deletions dist/rx-pubsub.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/rx-pubsub.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/rx-pubsub.min.js

Large diffs are not rendered by default.

Binary file added dist/rx-pubsub.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/rx-pubsub.min.js.map

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rx-pubsub",
"version": "0.0.7",
"version": "0.0.8",
"description": "PubSub service based on RxJs ReplaySubject",
"main": "dist/rx-pubsub.min.js",
"types": "index.d.ts",
Expand All @@ -17,10 +17,12 @@
"url": "https://github.com/t0w5a"
},
"repository": "t0w5a/rx-pubsub",
"licenses": [ {
"type": "MIT",
"url": "https://github.com/t0w5a/rx-pubsub/blob/master/LICENSE"
} ],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/t0w5a/rx-pubsub/blob/master/LICENSE"
}
],
"keywords": [
"rx-pubsub",
"rx-pub-sub",
Expand All @@ -34,11 +36,14 @@
"rxpubsub",
"eventemitter"
],
"dependencies": {},
"dependencies": {
"rxjs": "^5.3.1"
},
"devDependencies": {
"@types/jasmine": "^2.5.38",
"@types/node": "^6.0.52",
"@types/uuid": "^2.0.29",
"compression-webpack-plugin": "^0.4.0",
"istanbul-instrumenter-loader": "^1.1.0",
"jasmine-ajax": "^3.3.1",
"jasmine-core": "^2.5.2",
Expand All @@ -50,7 +55,6 @@
"karma-spec-reporter": "0.0.26",
"karma-typescript": "^2.1.3",
"karma-webpack": "^1.8.0",
"rxjs": "^5.3.1",
"tracekit": "^0.4.4",
"ts-loader": "^1.2.2",
"typescript": "^2.0.10",
Expand Down
8 changes: 4 additions & 4 deletions src/rx-pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class RxPubSub {
*/
public dispose(eventName: string): RxPubSub {
if (this.events[eventName]) {
this.events[eventName].unsubscribe();
this.getSubjectByEventName(eventName).unsubscribe();
delete this.events[eventName];
}
else {
Expand All @@ -101,7 +101,7 @@ export class RxPubSub {
*/
public hasSubscribers(eventName: string): boolean {
let result = false;
if (this.events[eventName] && this.events[eventName].hasObservers()) {
if (this.events[eventName] && this.getSubjectByEventName(eventName).observers.length > 0) {
result = true;
}

Expand Down Expand Up @@ -130,7 +130,7 @@ export class RxPubSub {
* @param previousMessagesNr Maximum element count of the replay buffer
* @returns {any}
*/
private getSubjectByEventName(eventName: string, previousMessagesNr: number = 1): ReplaySubject<any> {
protected getSubjectByEventName(eventName: string, previousMessagesNr: number = 1): ReplaySubject<any> {
// create new Subject if there is not such thing for the specified eventName
if (!this.events[eventName]) {
this.events[eventName] = new ReplaySubject(previousMessagesNr);
Expand All @@ -144,7 +144,7 @@ export class RxPubSub {
* @param callback Function to be checked
* @returns {boolean} true is the parameter is a function. false - if the parameter is not a function
*/
private isCallback(callback: (data?: any) => any): boolean {
protected isCallback(callback: (data?: any) => any): boolean {
if (!callback || typeof callback !== 'function') {
console.warn('Callback is missing! Subscription cancelled!');

Expand Down
10 changes: 9 additions & 1 deletion webpack.prod.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var webpack = require('webpack'),
path = require('path'),
VERSION = JSON.stringify(require("./package.json").version);
var CompressionPlugin = require("compression-webpack-plugin");

module.exports = {
entry: './src/rx-pubsub.ts',
Expand Down Expand Up @@ -29,7 +30,14 @@ module.exports = {
new webpack.DefinePlugin({
__VERSION__: VERSION
}),
new webpack.BannerPlugin('version: ' + VERSION, {raw: false, entryOnly: true})
new webpack.BannerPlugin('version: ' + VERSION, {raw: false, entryOnly: true}),
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.(js|html)$/,
threshold: 10240,
minRatio: 0.8
})
],
module: {
loaders: [
Expand Down

0 comments on commit 7d6f2c9

Please sign in to comment.