+21
| # Changelog | ||
| ## [2.0.0](https://www.github.com/gulpjs/sparkles/compare/v1.0.1...v2.0.0) (2022-02-01) | ||
| ### ⚠ BREAKING CHANGES | ||
| * Use a Symbol for attaching the default namespace to the store | ||
| * Use a Symbol for attaching the store to the global (#9) | ||
| * Normalize repository, dropping node <10.13 support (#6) | ||
| ### Features | ||
| * Use a Symbol for attaching the default namespace to the store ([2196fb1](https://www.github.com/gulpjs/sparkles/commit/2196fb1503f14f02c9422566d1e3635aa93e6ac0)) | ||
| * Use a Symbol for attaching the store to the global ([#9](https://www.github.com/gulpjs/sparkles/issues/9)) ([2196fb1](https://www.github.com/gulpjs/sparkles/commit/2196fb1503f14f02c9422566d1e3635aa93e6ac0)) | ||
| * Use Symbol.for so other applications can create the same Symbol ([2196fb1](https://www.github.com/gulpjs/sparkles/commit/2196fb1503f14f02c9422566d1e3635aa93e6ac0)) | ||
| ### Miscellaneous Chores | ||
| * Normalize repository, dropping node <10.13 support ([#6](https://www.github.com/gulpjs/sparkles/issues/6)) ([6d6f7a8](https://www.github.com/gulpjs/sparkles/commit/6d6f7a8633a437c474efb8a1768b3617f0f8e87d)) |
+3
-4
@@ -5,4 +5,4 @@ 'use strict'; | ||
| var sparklesNamespace = 'store@sparkles'; | ||
| var defaultNamespace = 'default'; | ||
| var sparklesNamespace = Symbol.for('sparkles:store'); | ||
| var defaultNamespace = Symbol.for('sparkles:namespace'); | ||
@@ -20,3 +20,2 @@ function getStore() { | ||
| function getEmitter(namespace) { | ||
| var store = getStore(); | ||
@@ -43,3 +42,3 @@ | ||
| return !!(store[namespace]); | ||
| return !!store[namespace]; | ||
| } | ||
@@ -46,0 +45,0 @@ |
+1
-1
| The MIT License (MIT) | ||
| Copyright (c) 2014 Blaine Bublitz <blaine.bublitz@gmail.com> and Eric Schoffstall <yo@contra.io> | ||
| Copyright (c) 2014-2015, 2018-2019, 2021 Blaine Bublitz <blaine.bublitz@gmail.com> and Eric Schoffstall <yo@contra.io> | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
+18
-12
| { | ||
| "name": "sparkles", | ||
| "version": "1.0.1", | ||
| "version": "2.0.0", | ||
| "description": "Namespaced global event emitter", | ||
@@ -12,3 +12,3 @@ "author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)", | ||
| "engines": { | ||
| "node": ">= 0.10" | ||
| "node": ">= 10.13.0" | ||
| }, | ||
@@ -23,15 +23,21 @@ "main": "index.js", | ||
| "pretest": "npm run lint", | ||
| "test": "mocha --async-only", | ||
| "cover": "istanbul cover _mocha --report lcovonly", | ||
| "coveralls": "npm run cover && istanbul-coveralls" | ||
| "test": "nyc mocha --async-only" | ||
| }, | ||
| "dependencies": {}, | ||
| "devDependencies": { | ||
| "eslint": "^2.13.0", | ||
| "eslint-config-gulp": "^3.0.1", | ||
| "expect": "^1.20.2", | ||
| "istanbul": "^0.4.3", | ||
| "istanbul-coveralls": "^1.0.3", | ||
| "mocha": "^3.5.3" | ||
| "eslint": "^7.32.0", | ||
| "eslint-config-gulp": "^5.0.1", | ||
| "eslint-plugin-node": "^11.1.0", | ||
| "expect": "^27.3.1", | ||
| "mocha": "^8.4.0", | ||
| "nyc": "^15.1.0" | ||
| }, | ||
| "nyc": { | ||
| "reporter": [ | ||
| "lcov", | ||
| "text-summary" | ||
| ] | ||
| }, | ||
| "prettier": { | ||
| "singleQuote": true | ||
| }, | ||
| "keywords": [ | ||
@@ -38,0 +44,0 @@ "ee", |
+12
-14
@@ -9,3 +9,3 @@ <p align="center"> | ||
| [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] | ||
| [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] | ||
@@ -20,6 +20,8 @@ Namespaced global event emitter | ||
| Note: If you put an event handler in a file in your application, that file must be loaded in via an import somewhere in your application, even if it's not directly being used. Otherwise, it will not be loaded into memory. | ||
| ```js | ||
| var sparkles = require('sparkles')(); // make sure to call the function | ||
| sparkles.on('my-event', function(evt){ | ||
| sparkles.on('my-event', function (evt) { | ||
| console.log('my-event handled', evt); | ||
@@ -35,3 +37,3 @@ }); | ||
| Returns an EventEmitter that is shared amongst the provided namespace. If no namespace | ||
| Returns an EventEmitter that is shared amongst the provided namespace. If no namespace | ||
| is provided, returns a default EventEmitter. | ||
@@ -51,16 +53,12 @@ | ||
| [downloads-image]: http://img.shields.io/npm/dm/sparkles.svg | ||
| <!-- prettier-ignore-start --> | ||
| [downloads-image]: https://img.shields.io/npm/dm/sparkles.svg?style=flat-square | ||
| [npm-url]: https://www.npmjs.com/package/sparkles | ||
| [npm-image]: http://img.shields.io/npm/v/sparkles.svg | ||
| [npm-image]: https://img.shields.io/npm/v/sparkles.svg?style=flat-square | ||
| [travis-url]: https://travis-ci.org/gulpjs/sparkles | ||
| [travis-image]: http://img.shields.io/travis/gulpjs/sparkles.svg?label=travis-ci | ||
| [ci-url]: https://github.com/gulpjs/sparkles/actions?query=workflow:dev | ||
| [ci-image]: https://img.shields.io/github/workflow/status/gulpjs/sparkles/dev?style=flat-square | ||
| [appveyor-url]: https://ci.appveyor.com/project/gulpjs/sparkles | ||
| [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/sparkles.svg?label=appveyor | ||
| [coveralls-url]: https://coveralls.io/r/gulpjs/sparkles | ||
| [coveralls-image]: http://img.shields.io/coveralls/gulpjs/sparkles/master.svg | ||
| [gitter-url]: https://gitter.im/gulpjs/gulp | ||
| [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg | ||
| [coveralls-image]: https://img.shields.io/coveralls/gulpjs/sparkles/master.svg?style=flat-square | ||
| <!-- prettier-ignore-end --> |
6005
23.74%5
25%61
-3.17%