
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.
Mixin and base class that allow easy usage of mobx observables with
lit-element
.
The mixin implementation is based heavily on the work of Alexander Weiss in his
mobx-lit-element
implementation. This has been rewritten to
support multiple forms of usage (mixin, or base class) as well as to be based on typescript to get type definitions.
As a dependency:
npm install --save @adobe/lit-mobx lit-element mobx
npm install
npm run demo
See the JavaScript and TypeScript example projects on StackBlitz. See this example for a demonstration of usage with Mobx v6 in Typescript without the use of decorators.
import { LitElement, html, TemplateResult, customElement } from 'lit-element';
import { observable, action } from 'mobx';
import { MobxLitElement } from '@adobe/lit-mobx';
// create a mobx observable
class Counter {
@observable
public count = 0;
@action
public increment() {
this.count++;
}
}
// create instance that can be shared across components
const counter = new Counter();
// create a new custom element, and use the base MobxLitElement class
// alternatively you can use the MobxReactionUpdate mixin, e.g. `class MyElement extends MobxReactionUpdate(LitElement)`
@customElement('my-element')
export class MyElement extends MobxLitElement {
private counter = counter
// any observables accessed in the render method will now trigger an update
public render(): TemplateResult {
return html`
Count is ${this.counter.count}
<br />
<button @click=${this.incrementCount}>Add</button>
`;
}
private incrementCount() {
this.counter.increment();
}
}
For further examples see the demo folder.
Contributions are welcomed! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.
FAQs
Integrating mobx with lit-element!
The npm package a-lit-mobx receives a total of 0 weekly downloads. As such, a-lit-mobx popularity was classified as not popular.
We found that a-lit-mobx 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.