How to use the inversify.tagged function in inversify

To help you get started, we’ve selected a few inversify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JohnSimerlink / branches_front_end_private / app / loaders / treeUser / TreeUserLoader.ts View on Github external
// TODO ^^ Figure out how to do this without casting
	}

	public isLoaded({treeId, userId}): boolean {
		const treeUserId = getTreeUserId({
			treeId,
			userId
		});
		return !!this.storeSource.get(treeUserId);
	}

}

@injectable()
export class TreeUserLoaderArgs {
	@inject(TYPES.FirebaseReference) @tagged(TAGS.TREE_USERS_REF, true) public firebaseRef: Reference;
	@inject(TYPES.ISubscribableTreeUserStoreSource) public storeSource: ISubscribableTreeUserStoreSource;
}
github JohnSimerlink / branches_front_end_private / app / objects / sigmaNode / CanvasUI.ts View on Github external
this.sigmaNodesUpdater = sigmaNodesUpdater;
		this.sigmaEdgesUpdater = sigmaEdgesUpdater;
	}

	public subscribe(obj: ISubscribable) {
		const updateNodes = this.sigmaNodesUpdater.handleUpdate.bind(this.sigmaNodesUpdater);
		const updateEdges = this.sigmaEdgesUpdater.handleUpdate.bind(this.sigmaEdgesUpdater);
		obj.onUpdate(updateNodes); // TODO: i'm pretty sure all the new edge logic is handled in nodesUpdater rather than edges updater. need to fix this
		obj.onUpdate(updateEdges);
	}
}

@injectable()
export class CanvasUIArgs {
	@inject(TYPES.ISigmaNodesUpdater)
	@tagged(TAGS.MAIN_SIGMA_INSTANCE, true)
	public sigmaNodesUpdater;
	@inject(TYPES.ISigmaEdgesUpdater)
	@tagged(TAGS.MAIN_SIGMA_INSTANCE, true)
	public sigmaEdgesUpdater;
}
github JohnSimerlink / branches_front_end_private / app / objects / stores / content / AutoSaveMutableSubscribableContentStore.ts View on Github external
});
		objectFirebaseAutoSaver.initialSave();
		objectFirebaseAutoSaver.start();
		// TODO: this needs to add the actual value into the db
		return contentItem;
	}
}

@injectable()
export class AutoSaveMutableSubscribableContentStoreArgs {
	@inject(TYPES.ISubscribableContentStoreSource)
	public storeSource;
	@inject(TYPES.Array)
	public updatesCallbacks;
	@inject(TYPES.FirebaseReference)
	@tagged(TAGS.CONTENT_REF, true)
	public contentFirebaseRef: Reference;
}
github JohnSimerlink / branches_front_end_private / app / objects / stores / StoreSourceUpdateListenerCore.ts View on Github external
throw new RangeError(JSON.stringify(type) + ' is not a valid update type');
		}
	}
}

@injectable()
export class StoreSourceUpdateListenerCoreArgs {
	// @inject(TYPES.ISigmaNodes) public sigmaNodes: ISigmaNodes
	@inject(TYPES.ISigmaNodesUpdater)
	@tagged(TAGS.MAIN_SIGMA_INSTANCE, true)
	public sigmaNodesUpdater: ISigmaNodesUpdater;
	@inject(TYPES.ISigmaEdgesUpdater)
	@tagged(TAGS.MAIN_SIGMA_INSTANCE, true)
	public sigmaEdgesUpdater: ISigmaEdgesUpdater;
	@inject(TYPES.IOneToManyMap)
	@tagged(TAGS.CONTENT_ID_SIGMA_IDS_MAP, true)
	public contentIdSigmaIdMap: IOneToManyMap;
	@inject(TYPES.BranchesStore)
	public store: Store;
}
github DefinitelyTyped / DefinitelyTyped / inversify / inversify-tests.ts View on Github external
public shuriken: IWeapon;
        public constructor(
            @tagged("canThrow", false) katana: IWeapon,
            @tagged("canThrow", true) shuriken: IWeapon
        ) {
            this.katana = katana;
            this.shuriken = shuriken;
        }
    }

    kernel.bind("Samurai").to(Samurai);
    kernel.bind("IWeapon").to(Katana).whenTargetTagged("canThrow", false);
    kernel.bind("IWeapon").to(Shuriken).whenTargetTagged("canThrow", true);

    let throwable = tagged("canThrow", true);
    let notThrowable = tagged("canThrow", false);

    @inject("IWeapon", "IWeapon")
    class Samurai2 implements ISamurai {
        public katana: IWeapon;
        public shuriken: IWeapon;
        public constructor(
            @throwable("canThrow", false) katana: IWeapon,
            @notThrowable("canThrow", true) shuriken: IWeapon
        ) {
            this.katana = katana;
            this.shuriken = shuriken;
        }
    }

    @inject("IWeapon", "IWeapon")
    class Samurai3 implements ISamurai {
github DXHeroes / dx-scanner / src / contexts / language / languageContextBinding.ts View on Github external
export const detectsLanguage = (language: ProgrammingLanguage) => {
  return tagged(DETECT_LANGUAGE_TAG, language);
};
github JohnSimerlink / branches_front_end_private / app / objects / sigmaEdge / sigmaEdgesUpdater.ts View on Github external
parentId: treeNode.parentId,
			treeId,
		});
		const edge = sigmaGraph.edges(edgeId);
		if (!edge) {
			throw new Error('SigmaInstanceGraphEdge with id of ' + edgeId + ' could not be found');
		}
		const color = ProficiencyUtils.getColor(contentUserProficiency);
		edge.color = color;
	}
}

@injectable()
export class SigmaEdgesUpdaterArgs {
	@inject(TYPES.IOneToManyMap)
	@tagged(TAGS.CONTENT_ID_SIGMA_IDS_MAP, true)
	public contentIdSigmaIdMap: IOneToManyMap;
	@inject(TYPES.IStoreGetters) public getters: IStoreGetters
}
github JohnSimerlink / branches_front_end_private / app / loaders / tree / TreeLoaderAndAutoSaver.ts View on Github external
const treeFirebaseRef = this.firebaseRef.child(treeId);
		const treeAutoSaver: IObjectFirebaseAutoSaver =
			new ObjectFirebaseAutoSaver({
				syncableObjectFirebaseRef: treeFirebaseRef,
				syncableObject: tree
			});
		treeAutoSaver.start();

		return treeData;
	}
}

@injectable()
export class TreeLoaderAndAutoSaverArgs {
	@inject(TYPES.FirebaseReference) @tagged(TAGS.TREES_REF, true) public firebaseRef: Reference;
	@inject(TYPES.ITreeLoader) @tagged(TAGS.SPECIAL_TREE_LOADER, true) public treeLoader: ITreeLoader;
}
github JohnSimerlink / branches_front_end_private / app / loaders / user / UserLoaderAndAutoSaver.ts View on Github external
const userFirebaseRef = this.firebaseRef.child(userId);
		const userAutoSaver: IObjectFirebaseAutoSaver =
			new ObjectFirebaseAutoSaver({
				syncableObjectFirebaseRef: userFirebaseRef,
				syncableObject: user
			});
		userAutoSaver.start();

		return user;
	}
}

@injectable()
export class UserLoaderAndAutoSaverArgs {
	@inject(TYPES.FirebaseReference) @tagged(TAGS.USERS_REF, true) public firebaseRef: Reference;
	@inject(TYPES.IUserLoader) public userLoader: IUserLoader;
}
github JohnSimerlink / branches_front_end_private / app / objects / stores / SubscribableStoreSource.ts View on Github external
@injectable()
export class SubscribableContentStoreSourceArgs {
	@inject(TYPES.Object) public hashmap;
	@inject(TYPES.Array) public updatesCalbacks: any[];
	@inject(TYPES.ObjectDataTypes)
	@tagged(TAGS.CONTENT_DATA, true)
	private type: CustomStoreDataTypes;
}

@injectable()
export class SubscribableContentUserStoreSourceArgs {
	@inject(TYPES.Object) public hashmap;
	@inject(TYPES.Array) public updatesCalbacks: any[];
	@inject(TYPES.ObjectDataTypes)
	@tagged(TAGS.CONTENT_USERS_DATA, true)
	private type: CustomStoreDataTypes;
}