
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
I like the Observer pattern. It is clear, it is smooth and it shines when combined with JavaScript and CoffeeScript. This is why I've created this little library which creates an Observable array, an array into which you can pass an observer and pass handlers.
The following functionality is supported:
initialize the CkArray:
var CkArray = require('ck-array')
var a = new CkArray()
You can now pass in an observable by calling something like:
var observable = {
prePush: function(argument) {},
postPush: function(argument) {},
preSlice: function(arguments) {},
postSlice: function(result) {},
preSplice: function(arguments) {},
postSplice: function(result) {},
}
a.observe( observable );
The argument
value is of course the argument(s) passed into the function. There is no way to cancel the action
yet in the 'pre' functions. There is no way to rollback yet. The result
value is the result from calling the
function on the array.
When you call one of the three methods on the Array:
Your function in the observable will be called.
There are a few things which I'd like to add to this observable array implementation, I would like a way to cancel and rollback a method call. I would also like to add implementations for all of the other array methods.
The 'thoughts' behind this implementation will not break in the coming releases. So most of the future extensions will be made to the observable object and the implementations of the other methods of the Array prototype. The current tests will not be broken.
FAQs
A simple observable array for JavaScript Frameworks
The npm package ck-array receives a total of 3 weekly downloads. As such, ck-array popularity was classified as not popular.
We found that ck-array 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.