
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
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 data is empty | 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 190 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 3 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
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.