Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@agile-ts/core

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agile-ts/core - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

8

CHANGELOG.md

@@ -6,4 +6,12 @@ # Change Log

## [0.0.5](https://github.com/agile-ts/agile/compare/v0.0.4...v0.0.5) (2020-11-05)
**Note:** Version bump only for package @agile-ts/core
## 0.0.4 (2020-11-03)
**Note:** Version bump only for package @agile-ts/core

15

dist/collection/index.d.ts

@@ -1,2 +0,2 @@

import { Agile, Item, Group, GroupKey, Selector, SelectorKey, StateKey, StorageKey, GroupConfigInterface, CollectionPersistent } from "../internal";
import { Agile, Item, Group, GroupKey, Selector, SelectorKey, StateKey, StorageKey, GroupConfigInterface, CollectionPersistent, GroupAddConfig } from "../internal";
export declare class Collection<DataType = DefaultItem> {

@@ -159,2 +159,15 @@ agileInstance: () => Agile;

/**
* @public
* Resets this Collection
*/
reset(): void;
/**
* @public
* Puts ItemKey/s into Group/s (GroupKey/s)
* @param itemKeys - ItemKey/s that get added to provided Group/s
* @param groupKeys - Group/s to which the ItemKey/s get added
* @param config - Config
*/
put(itemKeys: ItemKey | Array<ItemKey>, groupKeys: GroupKey | Array<GroupKey>, config?: GroupAddConfig): void;
/**
* @internal

@@ -161,0 +174,0 @@ * Updates ItemKey of Item

@@ -453,2 +453,49 @@ "use strict";

//=========================================================================================================
// Reset
//=========================================================================================================
/**
* @public
* Resets this Collection
*/
reset() {
var _a, _b;
// Remove Items from Storage
for (let key in this.data) {
const item = this.getItemById(key);
(_a = item === null || item === void 0 ? void 0 : item.persistent) === null || _a === void 0 ? void 0 : _a.removeValue();
}
// Reset Groups
for (let key in this.groups)
(_b = this.getGroup(key)) === null || _b === void 0 ? void 0 : _b.reset();
// Reset Data
this.data = {};
this.size = 0;
// Reselect Items
for (let key in this.selectors) {
const selector = this.getSelector(key);
selector === null || selector === void 0 ? void 0 : selector.select(selector === null || selector === void 0 ? void 0 : selector.itemKey, { force: true });
}
}
//=========================================================================================================
// Put
//=========================================================================================================
/**
* @public
* Puts ItemKey/s into Group/s (GroupKey/s)
* @param itemKeys - ItemKey/s that get added to provided Group/s
* @param groupKeys - Group/s to which the ItemKey/s get added
* @param config - Config
*/
put(itemKeys, groupKeys, config = {}) {
const _itemKeys = internal_1.normalizeArray(itemKeys);
const _groupKeys = internal_1.normalizeArray(groupKeys);
// Add ItemKeys to Groups
_groupKeys.forEach((groupKey) => {
const group = this.getGroup(groupKey);
_itemKeys.forEach((itemKey) => {
group === null || group === void 0 ? void 0 : group.add(itemKey, config);
});
});
}
//=========================================================================================================
// Update Item Key

@@ -544,3 +591,2 @@ //=========================================================================================================

}
// TODO
// Remove Selectors that represents this Item

@@ -547,0 +593,0 @@ for (let selectorKey in this.selectors) {

@@ -48,2 +48,3 @@ import { Collection, DefaultItem, Item, ItemKey, State } from "../internal";

* @param sideEffects - If Side Effects of Selector get executed
* @param force - Force to select ItemKey
*/

@@ -53,2 +54,3 @@ export interface SelectConfigInterface {

sideEffects?: boolean;
force?: boolean;
}

@@ -48,3 +48,8 @@ "use strict";

sideEffects: true,
force: false,
});
if ((oldItem === null || oldItem === void 0 ? void 0 : oldItem.key) === itemKey && !config.force) {
console.warn(`Agile: Selector has already selected key '${itemKey}'!`);
return this;
}
// Remove old Item from Collection if it is an Placeholder

@@ -51,0 +56,0 @@ if (oldItem === null || oldItem === void 0 ? void 0 : oldItem.isPlaceholder)

16

dist/runtime/index.js

@@ -53,4 +53,2 @@ "use strict";

this.perform(performJob);
else
console.warn("Agile: No Job in queue!");
}

@@ -82,10 +80,10 @@ }

this.perform(performJob);
else
console.warn("Agile: No Job in queue!");
}
else {
// https://stackoverflow.com/questions/9083594/call-settimeout-without-delay
setTimeout(() => {
this.updateSubscribers();
});
if (this.jobsToRerender.length > 0) {
// https://stackoverflow.com/questions/9083594/call-settimeout-without-delay
setTimeout(() => {
this.updateSubscribers();
});
}
}

@@ -105,2 +103,4 @@ }

}
if (this.jobsToRerender.length <= 0)
return;
// Subscriptions that has to be updated/rerendered (Set = For preventing double subscriptions without further checks)

@@ -107,0 +107,0 @@ const subscriptionsToUpdate = new Set();

@@ -119,2 +119,8 @@ import { Agile, StorageKey, StateObserver, StatePersistent, Observer, StateJobConfigInterface, StatePersistentConfigInterface } from "../internal";

* @public
* Creates a Watcher that gets once called when the State Value changes for the first time and than destroys itself
* @param callback - Callback Function that gets called if the State Value changes
*/
onInaugurated(callback: Callback<ValueType>): void;
/**
* @public
* Checks if watcher at given Key exists

@@ -121,0 +127,0 @@ * @param key - Key of Watcher

@@ -234,2 +234,14 @@ "use strict";

}
/**
* @public
* Creates a Watcher that gets once called when the State Value changes for the first time and than destroys itself
* @param callback - Callback Function that gets called if the State Value changes
*/
onInaugurated(callback) {
const watcherKey = "InauguratedWatcher";
this.watch(watcherKey, () => {
callback(this.getPublicValue());
this.removeWatcher(watcherKey);
});
}
//=========================================================================================================

@@ -236,0 +248,0 @@ // Has Watcher

{
"name": "@agile-ts/core",
"version": "0.0.4",
"version": "0.0.5",
"author": "BennoDev",

@@ -5,0 +5,0 @@ "license": "ISC",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc