本文整理汇总了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;未经允许,请勿转载。 |
请发表评论