![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
2kb
engine for your handy microframework.
You can install lighty
from npm
.
$ npm install --save lighty
And use it as CommonJS module:
const createEngine = require('lighty');
Or as ES module:
import createEngine from 'lighty';
Additionally, we provide full and minified UMD versions. Bundles included to
npm
package, or you can download them from
unpkg.io. After just include them
to your HTML:
<script src="lighty.min.js"></script>
Let's write simple application:
<div class="awesome-component">
Not awesome yet.
</div>
import createEngine from 'lighty';
const engine = createEngine((element, fn) => fn(element));
engine.component('.awesome-component', element => {
element.innerText = "It's awesome now.";
});
console.log(document.querySelector('.awesome-component').innerText);
# => "It's awesome now."
Modern frontend focused on developing RIA-applications. Most popular frameworks and libraries created for this purpose.
There are still content websites at this time. This websites usually use simple unstructured jQuery code which becomes difficult to maintain with the growth of the project.
The primary objective of this project is a providing tool for structuring code using the component model. Also, the objectives are:
Core of any lighty
application which launches an application, register and
vitalize components.
See also Engine.
An application launched when DOM will be ready. Engine checks document.readyState
property and uses DOMContentLoaded
event for this purpose.
Engine vitalize all registered components on launch. And will vitalize all newly registered components immediately.
Component registration is a linking of a valid CSS selector with arguments list. Selector will be used for select elements in DOM. Arguments list will be applied to a builder.
See also component.
Vitalize is a process from two steps:
Only one component's instance will be created for each element at application's lifecycle.
See also vitalize.
User function which creates component's instance and binds then with DOM element.
See also Builder.
Application's engine. Controls application's lifecycle, register and vitalize components.
Engine
Creates engine's instance with given builder
.
String
A valid CSS selector.
Element
| NodeList
| Array.<Element>
| CSSSelector
One or many DOM elements for search.
any
Creates component's instance with linked arguments for given element
.
any
Callback which will be called on engine start.
Application's engine. Controls application's lifecycle, register and vitalize components.
Kind: global class
undefined
undefined
undefined
Register component with given selector
and builder's args
list.
Vitalize component if an application is already running.
Kind: static method of Engine
Returns: undefined
- .
Param | Type | Description |
---|---|---|
selector | CSSSelector | linked selector. |
...args | any | linked builder's arguments list. |
undefined
Vitalize all registered components inside given trees
.
Recommended use this method inside components. Components always created
after application launch, so vitalize
don't be called before start.
If you update HTML inside some element, then use them as tree root for performance purposes.
Kind: static method of Engine
Returns: undefined
- .
Throws:
Error
when an application is not launched yet.TypeError
when trees have not acceptable type.Param | Type | Default | Description |
---|---|---|---|
[trees] | Trees | document.body | roots of search trees. |
Example
element.innerHTML = `...`;
engine.vitalize(element);
Engine
Creates engine's instance with given builder
.
Kind: global function
Returns: Engine
- engine's instance.
Throws:
TypeError
when builder
is not a function.Param | Type | Description |
---|---|---|
builder | BuilderFn | user defined builder of components. |
[onStart] | OnStartFn | callback which will be called on application launch. |
String
A valid CSS selector.
Element
| NodeList
| Array.<Element>
| CSSSelector
One or many DOM elements for search.
any
Creates component's instance with linked arguments for given element
.
Kind: global typedef
Returns: any
- .
Param | Type | Description |
---|---|---|
element | Element | an element for which a component's instance will be created. |
...args | any | linked arguments list for builder. |
any
Callback which will be called on engine start.
Kind: global typedef
Returns: any
- .
Released under the MIT license.
0.9.0 (27 April 2017)
FAQs
The tiny engine for your handy microframework
We found that lighty 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.