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

TypeScript WeakMap.delete函数代码示例

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

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



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

示例1: setTabListeners

/**
 * A utility function that sets the listeners for a tab which are then passed in the generated VDom.  The function
 * returns a handle that can be used to clean up the listeners
 * @param tabbed The tabbed mixin that should be effected when the listeners fire
 * @param tab The tab that the listeners are referring to
 */
function setTabListeners(tabbed: TabbedMixin<TabbedChild, TabbedState>, tab: TabbedChild): Handle {
	/* TODO: There is an edge case where if a child tab is moved from one tabbed panel to another without being destroyed */
	tabListenersMap.set(tab, {
		onclickTabListener(evt: MouseEvent): boolean {
			evt.preventDefault();
			setActiveTab(tabbed, tab);
			return true;
		},
		onclickTabCloseListener(evt: MouseEvent): boolean {
			evt.preventDefault();
			tab.close().then((result) => {
				/* while Maquette schedules a render on DOM events, close happens async, therefore we have to
				 * invalidate the tabbed when resolved, otherwise the tab panel won't reflect the actual
				 * children */
				if (result) {
					tabbed.invalidate();
				};
			});
			return true;
		}
	});
	return {
		destroy() {
			const tabListeners = tabListenersMap.get(tab);
			if (tabListeners) {
				tabListenersMap.delete(tab);
			}
		}
	};
}
开发者ID:danice,项目名称:widgets,代码行数:36,代码来源:createTabbedMixin.ts


示例2: Promise

		return new Promise((resolve) => {
			handlesWeakMap.get(this).forEach((handle) => {
				handle && handle.destroy && handle.destroy();
			});
			handlesWeakMap.delete(this);
			this.destroy = noop;
			this.own = destroyed;
			resolve(true);
		});
开发者ID:benpope82,项目名称:widgets,代码行数:9,代码来源:createDestroyable.ts


示例3: setTabListeners

/**
 * A utility function that sets the listeners for a tab which are then passed in the generated VDom.  The function
 * returns a handle that can be used to clean up the listeners
 * @param tabbed The tabbed mixin that should be effected when the listeners fire
 * @param tab The tab that the listeners are referring to
 */
function setTabListeners(tabbed: TabbedMixin<TabbedChild, TabbedState>, tab: TabbedChild): Handle {
	/* TODO: There is an edge case where if a child tab is moved from one tabbed panel to another without being destroyed */
	tabListenersMap.set(tab, {
		onclickTabListener(evt: MouseEvent): boolean {
			evt.preventDefault();
			setActiveTab(tabbed, tab);
			return true;
		},
		onclickTabCloseListener(evt: MouseEvent): boolean {
			evt.preventDefault();
			/* TODO: actually close the tab */
			console.log('close');
			return;
		}
	});
	return {
		destroy() {
			const tabListeners = tabListenersMap.get(tab);
			if (tabListeners) {
				tabListenersMap.delete(tab);
			}
		}
	};
}
开发者ID:benpope82,项目名称:widgets,代码行数:30,代码来源:createTabbedMixin.ts


示例4: unobserve

				}, (err) => { /* error handler */
					stateful.emit({
						type: 'error',
						target: stateful,
						error: err
					});
					unobserve(stateful);
				}, () => { /* completed handler */
					unobserve(stateful);
				}),
				handle: {
					destroy() {
						const observedState = observedStateMap.get(stateful);
						if (observedState) {
							observedState.subscription.unsubscribe();
							observedStateMap.delete(stateful);
						}
					}
				}
			};
			observedStateMap.set(stateful, observedState);
			return observedState.handle;
		}
	}, (instance: any, options: StatefulOptions<State>) => {
		const state = {};
		stateWeakMap.set(instance, state);
		if (options) {
			if (options.state) {
				instance.setState(options.state);
			}
			if (options.id && options.stateFrom) {
开发者ID:benpope82,项目名称:widgets,代码行数:31,代码来源:createStateful.ts


示例5: getTabChildVNode

				tabbed.children.forEach((tab, key) => {
					const isActiveTab = tab === activeTab;
					if (isActiveTab || (childrenNodes[key] && childrenNodes[key].properties.classes['visible'])) {
						tab.invalidate();
						const tabVNode = tab.render();
						tabVNode.properties.classes['visible'] = isActiveTab;
						childrenNodes[key] = tabVNode;
					}
					/* else, this tab isn't active and hasn't been previously rendered */

					tabs.push(h(tabbed.tagNames.tab, { key: tab, classes: { active: isActiveTab } }, getTabChildVNode(tab)));
				});

				return [ h(tabbed.tagNames.tabBar, tabs), h('div.panels', childrenNodes) ];
			}
		}
	})
	.mixin({
		mixin: createDestroyable,
		initialize(instance: TabbedMixin<TabbedChild, TabbedState>) {
			instance.own({
				destroy() {
					childrenNodesCache.delete(instance);
				}
			});
		}
	}) as TabbedMixinFactory;

export default createTabbedMixin;
开发者ID:danice,项目名称:widgets,代码行数:29,代码来源:createTabbedMixin.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript WeakMap.get函数代码示例发布时间:2022-05-25
下一篇:
TypeScript Promise.resolve函数代码示例发布时间: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