
Research
/Security News
Two Joyfill npm Beta Releases Compromised to Deliver DEV#POPPER Remote Access Trojan
Two Joyfill npm beta releases contain an import-time implant that uses blockchain transactions to retrieve a remote-access trojan.
A Javascript MVVM Library for Building Interface.
LiKy ( name combined with '狸' and 'Kyles' ) is a Javascript MVVM Library to help web developers building user interface. It is a project created by Kyles Light for learning and personal use. The core of LiKy is really tiny ( compressed size of version 0.0.2 is 13 KB ) but made easy to use.
LiKy is inspired by a series of awesome librarys such as React , Vue and Spine, it contains a few ideas to make web development more simple and efficient :
And that's it!
It's easy to install LiKy with npm :
npm i --save liky
Or you can just include it in your script tag :
<script src="http://kyleslight.net/static/file/liky.min.js"></script>
There is a demo page to show you how to get start with it.
To start with LiKy, create a component with common attributes object, the common attributes is optional :
var Component = LiKy.createComponent();
Common attributes will be shared by all instance created by this component, it will hold the methods and component config data:
var Component = LiKy.createComponent({
$reactive: true,
foo: function () {
// do something
}
});
The component we created is a reusable constructor, it acts much like a Class. We can create a LiKy instance by passing it a element selector string and a initial state object ( optional ) to help it initialise and render with state, if we have an element like :
<div id="app">
{{message}}
</div>
We can bind it with state:
Component.bindElement('#app', {
message: 'Well, this is LiKy desu!'
});
After the initial render process, the element will be rendered :
<div id="app">
Well, this is LiKy desu!
</div>
The component can bind more than one element :
var Component = LiKy.createComponent({
changeMessage: function () {
// do something for your message
}
});
Component.bindElement('#app1', {
message: 'Some Text'
});
Component.bindElement('#app2', {
message: 'Another Text'
});
So the common method and data can be reused by them.
Any LiKy instance has a state object, which is the Model of the term 'MVVM'. You can access it just like normal Javascript object :
// in your component method
var text = this.state.message;
this.state.message = 'Another Text';
state can be changed rapidly. By default, the change will not trigger render process until you call setState method, in loose mode ( current version only loose mode is implemented ), you can pass the changed attributes to setState, or you can just write setState() to remind LiKy it's time to render :
// in your component method
// way 1
this.state.todos.push('Another Todo');
this.setState({
id: -1
}); // todos and id will all be changed
// way 2
this.state.todos.push('Another Todo');
this.state.id = -1;
this.setState(); // way 1 and way 2 did the same thing
The template engine of LiKy is implemented individually. But don't worry, the syntax is quite simple and acts like other template engine:
{{<YourStateAttribute>}} will be replaced by your state attribute value string ( after HTML escaping ), if the value is undefined, it will display nothing.{{{<YourStateAttribute>}}} if you do want to replace with HTML string ( mind it would cause safety issue ).lk-for will traverse state attribute ( it should be an array ), render all items in order. In lk-for='<item> in <items>', <items> represents your state attribute, <item> is an median value in each looping process. The looping syntax support nested.lk-if, the elemen will/will not be render when the value ( state attribute ) is true/false. The lk-not does the opposite thing.If you have declared the methods in element attribute lk-on ( note the event name should be listed in https://developer.mozilla.org/en-US/docs/Web/Events ):
<div id="app">
<button lk-on="click:Clicked">Click</button>
</div>
the method will be delegated to the root element ( in this case #app ) automatically, remember to define the associated method in your component :
LiKy.createComponent({
clicked: function () {
console.log('be clicked');
}
}).bindElement('#app');
All things will be done as you imagine. If you have more than one event to be handle, declared it in this way :
<input type="text" lk-on="input:inputed;blur:blured">
The state attributes will be changed in two different ways : dynamically modified in common method or modified by input value. If an element have value and lk-state attributes, any change in your Input element will automatically trigger the change of state ( not be render ):
<input type="text" lk-state="content">
so you can access the real-time value of input in common method.
// in your component method
var content = this.state.content; // real-time value
You can dynamically change your element attribute by setting lk-attr :
<div class="block" lk-state="class:color"></div>
So when you change color in your state:
// in your component method
this.setState({
color: 'red'
});
The element will be :
<div class="block red" lk-state="class:color"></div>
color to blue, the value red will be replaced.state.lk-state="class:class1,class2..." to set multi-class.lk-state="attr1:value1;attr2:value2..." to set multi-attribute.LiKy is MIT licensed, so you are free to use it.
FAQs
A Javascript MVVM Library
We found that liky 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.

Research
/Security News
Two Joyfill npm beta releases contain an import-time implant that uses blockchain transactions to retrieve a remote-access trojan.

Security News
Socket releases free Certified Patches for high-severity Nuxt vulnerabilities, including server-side remote code execution through server island props.

Security News
An open letter signed by 50 companies, from NVIDIA and Microsoft to Mistral and Hugging Face, urges Washington not to restrict open weight AI.