![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
seng-signals
Advanced tools
Signal is a Observer Pattern that works on the basis that every event has its own controller, its more clear what a controller dispatches and its hi-performance.
npm install --save seng-signals
We also have browser, amd, commonjs, umd, systemjs and es6 versions of this module available attached to the Github Releases.
Check the build section below to see your you can build for all the targets yourself.
import {Signal, Signal1, Signal2} from 'seng-signals';
var signal = new Signal();
var connection = signal.connect(function(){
console.log('emitted');
});
signal.emit(); // console.log('emitted');
signal.emit(); // console.log('emitted');
signal.emit(); // console.log('emitted');
// -----
connection.dispose();
var signal = new Signal();
var connection = signal.connect(function(){
console.log('emitted');
});
connection.once();
signal.emit(); // console.log('emitted');
signal.emit(); // nothing
signal.emit(); // nothing
// -----
var signal = new Signal1();
var connection = signal.connect(function(value){
console.log('emitted:', value);
});
signal.emit(1); // console.log('emitted:', 1);
signal.emit(2); // console.log('emitted:', 2);
signal.emit(3); // console.log('emitted:', 3);
// -----
var signal = new Signal2();
var connection = signal.connect(function(a, b){
console.log('emitted:', a, b);
});
signal.emit('apple', 1); // console.log('emitted:', 'apple', 1);
signal.emit('pinapple', 2); // console.log('emitted:', 'apple', 1);
connection.dispose();
signal.disconnectAll();
signal.emit('sugar', 3); // nothing
// -----
var signal = new Signal();
signal.connect(function(a, b){
console.log('emitted A');
}).once();
// put this listener on top of all others
signal.connect(function(){
console.log('emitted B');
}, true).once();
signal.emit();
// -----
This is all hypothetical fetch streaming code, this just gives a example of how to use signals in different setting.
class Loader {
constructor(path){
this.path = path;
this.progress = new Signal1();
this.complete = new Signal();
}
load(){
var _this = this;
fetch(this.path).then(response => {
var reader = response.body.getReader();
var bytesReceived = 0;
var totalBytes = 1000000;
reader.read().then(function processResult(result) {
if (result.done) {
_this.complete.emit();
return;
}
bytesReceived += result.value.length;
_this.progress.emit(bytesReceived/totalBytes);
return reader.read().then(processResult);
});
});
}
}
View the generated documentation.
In order to build signals, ensure that you have Git and Node.js installed.
Clone a copy of the repo:
git clone https://github.com/mediamonks/seng-signals.git
Change to the signals directory:
cd seng-signals
Install dev dependencies:
npm install
Use one of the following main scripts:
npm run build # build this project
npm run dev # run dev-watch mode, seving example/index.html in the browser
npm run generate # generate all artifacts (compiles ts, webpack, docs and coverage)
npm run test-unit # run the unit tests
npm run validate # runs validation scripts, including test, lint and coverage check
npm run lint # run tslint on this project
npm run doc # generate typedoc documentation
npm run typescript-npm # just compile the typescript output used in the npm module
When installing this module, it adds a pre-push hook, that runs the validate
script before committing, so you can be sure that everything checks out.
If you want to create the distribution files yourself, you can run the
build-dist
script, and the following files will get generated in the
dist
folder:
window.SengSignals
View CONTRIBUTING.md
View CHANGELOG.md
View AUTHORS.md
FAQs
Signals
The npm package seng-signals receives a total of 2 weekly downloads. As such, seng-signals popularity was classified as not popular.
We found that seng-signals demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.