![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.
async-source
Advanced tools
With AsyncSource you can
In case of multiple calls - only last call will be processed. Connect AsyncSource to your dynamic selects with in build debounce
npm install --save async-source
// javascript
import AsyncSource from 'async-source';
const source = new AsyncSource(request);
async function loadItems() {
await source.update(...requestParams);
const response = source.data;
}
// typescript
import AsyncSource from 'async-source';
const source = new AsyncSource<RespnonsType>(request);
async function loadItems() {
await source.update(...requestParams);
const response = source.data;
}
Parameter | Is required | Description |
---|---|---|
serviceMethod | true | Method that returns promise |
errorHandler | false | Function that will be called in case of service method rejected |
delay | false | delay in ms |
Property | Description | Type |
---|---|---|
data | Returns your method response | Your method response |
isLoading | Returns true when request pending | Boolean |
isFetch | Returns true after first load | Boolean |
Method | Description | Params |
---|---|---|
update | Calls be request | Your method request params |
push | Calls be request and handles success response | Success handler, Your method request params |
updateIfEmpty | Calls be request in source if data is empty | Your method request params |
updateImmediate | Calls be request in source ignoring debounce | Your method request params |
clear | Set source data to initial state(null) | --- |
<template>
<ul v-loading="isLoading">
<li v-for="item in items" :key="item.id">
{{ item.name }}
</li>
</ul>
</template>
<script>
import AsyncSource from 'async-source';
import { computed, reactive } from 'vue';
export default {
name: 'MyComponent',
setup() {
function errorHandler(error) {
console.error(error);
}
const source = reactive(new AsyncSource(request, errorHandler, 300));
source.update();
const items = computed(() => source.data || []);
const isLoading = computed(() => source.isLoading);
return {
items,
isLoading
};
}
}
</script>
<template>
<ul v-loading="isLoading">
<li v-for="item in items" :key="item.id">
{{ item.name }}
</li>
</ul>
</template>
<script>
import AsyncSource from 'async-source';
export default {
name: 'MyComponent',
data() {
return {
source: new AsyncSource(request, this.errorHandler, 300)
}
},
computed: {
items() {
return this.source.data || [];
},
isLoading() {
return this.source.isLoading;
}
},
created() {
this.source.update();
},
methods: {
errorHandler(error) {
console.error(error);
}
}
}
</script>
FAQs
async requests wrapper
The npm package async-source receives a total of 0 weekly downloads. As such, async-source popularity was classified as not popular.
We found that async-source demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.