• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript Map.set函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中dojo-shim/Map.set函数的典型用法代码示例。如果您正苦于以下问题:TypeScript set函数的具体用法?TypeScript set怎么用?TypeScript set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: function

		initialize: function(instance: TrackableSubCollection<T, O, U, C>, options?: TrackableOptions<T>) {
			options = options || {};
			instanceStateMap.set(instance, {
				isTracking: Boolean(options.isTracking),
				sourceQuery: options.sourceQuery,
				localData: [],
				idToIndex: new Map<string, number>(),
				observers: [],
				toRemoveIndices: []
			});

			if (options.isTracking && instance.source) {
				const state = instanceStateMap.get(instance);
				instance.fetch().then(function(data) {
					state.localData = data;
					instance.identify(data).forEach(function(id, index) {
						state.idToIndex.set(id, index);
					});
				});

				state.observable = new Observable<TrackedStoreDelta<T>>(function(observer: Observer<TrackedStoreDelta<T>>) {
					state.observers.push(observer);
					return () => {
						return state.toRemoveIndices.push(state.observers.indexOf(observer));
					};
				}.bind(instance));

				instance.source.observe().subscribe(buildTrackedUpdate(state, instance));
			}
		},
开发者ID:maier49,项目名称:store,代码行数:30,代码来源:createTrackableMixin.ts


示例2: get

interface TodoRegistryOptions {
	widgetStore: MemoryStore<Object>;
}

interface TodoRegistry {
	get(id: string): Promise<TodoItem>;
	identify(value: TodoItem): string;
	widgetStore?: MemoryStore<Object>;
}

const todoRegistryFactory = compose({
	get(id: string): Promise<TodoItem> {
		let widget: TodoItem = idToWidgetMap.get(id);
		if (!widget) {
			widget = createTodoItem({id, stateFrom: this.widgetStore});
			widgetToIdMap.set(widget, id);
			idToWidgetMap.set(id, widget);
		}
		return Promise.resolve(widget);
	},
	identify(value: TodoItem): string {
		return widgetToIdMap.get(value);
	}
}, function (todoRegistry: TodoRegistry, options: TodoRegistryOptions) {
	if (options) {
		todoRegistry.widgetStore = options.widgetStore;
	}
});

export default todoRegistryFactory;
开发者ID:Tomdye,项目名称:dojo2-todo-mvc,代码行数:30,代码来源:createTodoRegistry.ts


示例3: stackSelector

							{ originalPoints: [], columns: [], isNegative: true, relativeValue: 0, value: 0 },
							{ originalPoints: [], columns: [], isNegative: false, relativeValue: 0, value: 0 }
						];
					};

					for (const point of originalPoints) {
						const { datum } = point;
						const { input, relativeValue, value } = datum;

						// Note that the ordering of the stacks is determined by the original sort order, as is the
						// ordering of nodes within the stack.
						const stack = stackSelector(input);
						const signed = stacks.get(stack) || createSigned();
						const record = relativeValue < 0 ? signed[0] : signed[1];
						if (!stacks.has(stack)) {
							stacks.set(stack, signed);
						}

						record.originalPoints.push(point);
						record.columns.push(datum);
						record.relativeValue += relativeValue;
						record.value += value;

						if (record.relativeValue < mostNegativeRelValue) {
							mostNegativeRelValue = record.relativeValue;
						}
						else if (record.relativeValue > mostPositiveRelValue) {
							mostPositiveRelValue = record.relativeValue;
						}

						if (record.value < mostNegativeValue) {
开发者ID:novemberborn,项目名称:dojo2-dataviz,代码行数:31,代码来源:createStackedColumnChart.ts


示例4:

			store.identify(newData).forEach(function(id, index) {
				newIndex.set(id, index);
			});
开发者ID:maier49,项目名称:store,代码行数:3,代码来源:createTrackableMixin.ts


示例5: groupSelector

						y1: number;
					}
					const groups = new Map<G, Record>();
					const createRecord = (): Record => {
						return { originalPoints: [], columns: [], totalValue: 0, value: 0, y1: columnHeight };
					};

					for (const point of originalPoints) {
						const { input, relativeValue, value } = point.datum;

						// Note that the ordering of the groups is determined by the original sort order, as is the
						// ordering of nodes within the group.
						const group = groupSelector(input);
						const record = groups.get(group) || createRecord();
						if (!groups.has(group)) {
							groups.set(group, record);
						}

						record.originalPoints.push(point);
						record.columns.push(point.datum);
						record.totalValue += value;
						if (relativeValue < 0) {
							record.value = Math.min(record.value, value);
						}
						else {
							// Note that the expected value for mixed groups is undefined.
							record.value = Math.max(record.value, value);
						}
						record.y1 = Math.min(record.y1, point.y1);
					}
开发者ID:novemberborn,项目名称:dojo2-dataviz,代码行数:30,代码来源:createGroupedColumnChart.ts



注:本文中的dojo-shim/Map.set函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript Promise.all函数代码示例发布时间:2022-05-25
下一篇:
TypeScript Map.has函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap