本文整理汇总了TypeScript中dojo-core/WeakMap.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: getTabListeners
/**
* Return (or initilize) the tab listeners for a tab
* @param tabbed The tabbed mixin that the listerns refer to
* @param tab The tab that the listeners should be retrieved for
*/
function getTabListeners(tabbed: TabbedMixin<TabbedChild, TabbedState>, tab: TabbedChild): TabListeners {
if (!tabListenersMap.has(tab)) {
/* When the tab is destroyed, it will remove its listeners */
tab.own(setTabListeners(tabbed, tab));
}
return tabListenersMap.get(tab);
}
开发者ID:benpope82,项目名称:widgets,代码行数:12,代码来源:createTabbedMixin.ts
示例3: setStatefulState
function setStatefulState(stateful: Stateful<State>, value: State) {
const state = deepAssign(stateWeakMap.get(stateful), value);
stateful.emit({
type: 'statechange',
state,
target: stateful
});
return state;
}
开发者ID:benpope82,项目名称:widgets,代码行数:9,代码来源:createStateful.ts
示例4: resolve
let registryHandle = actions.get(this).register(id, () => {
const promise = new Promise<void>((resolve) => {
resolve(action.configure(this._registry));
}).then(() => action);
registryHandle.destroy();
registryHandle = actions.get(this).register(id, () => promise);
return promise;
});
开发者ID:digideskio,项目名称:app,代码行数:9,代码来源:createApp.ts
示例5: 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
示例6: factory
let registryHandle = widgets.get(this).register(id, () => {
const promise = Promise.resolve().then(() => {
// Always call the factory in a future turn. This harmonizes behavior regardless of whether the
// factory is registered through this method or loaded from a definition.
return factory();
});
registryHandle.destroy();
registryHandle = widgets.get(this).register(id, () => promise);
return promise;
});
开发者ID:dylans,项目名称:app,代码行数:10,代码来源:createApp.ts
示例7: factory
let registryHandle = stores.get(this).register(id, () => {
const promise = Promise.resolve().then(() => {
// Always call the factory in a future turn. This harmonizes behavior regardless of whether the
// factory is registered through this method or loaded from a definition.
return factory();
});
// Replace the registered factory to ensure next time this store is needed, the same store is returned.
registryHandle.destroy();
registryHandle = stores.get(this).register(id, () => promise);
return promise;
});
开发者ID:digideskio,项目名称:app,代码行数:11,代码来源:createApp.ts
示例8: 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
示例9: assign
props.classes = classes;
props.styles = projector.styles || {};
if (overrides) {
assign(props, overrides);
}
return props;
},
render(): VNode {
const projector: Projector = this;
const childVNodes: VNode[] = [];
projector.children.forEach((child) => childVNodes.push(child.render()));
return h(projector.tagName || 'div', projector.getNodeAttributes(), childVNodes);
},
attach(append?: boolean): Handle {
const projector: Projector = this;
const projectorData = projectorDataMap.get(projector);
if (projectorData.state === ProjectorState.Attached) {
return projectorData.attachHandle;
}
projectorData.boundRender = projector.render.bind(projector);
/* attaching async, in order to help ensure that if there are any other async behaviours scheduled at the end of the
* turn, they are executed before this, since the attachement is actually done in turn, but subsequent schedule
* renders are done out of turn */
queueTask(() => {
(append ? projectorData.projector.append : projectorData.projector.merge)(projectorData.root, projectorData.boundRender);
});
projectorData.state = ProjectorState.Attached;
projectorData.attachHandle = projector.own({
destroy() {
if (projectorData.state === ProjectorState.Attached) {
projectorData.projector.stop();
开发者ID:kitsonk,项目名称:widgets,代码行数:31,代码来源:projector.ts
示例10: Promise
return new Promise((resolve) => {
resolve(widgets.get(this).get(id)());
});
开发者ID:digideskio,项目名称:app,代码行数:3,代码来源:createApp.ts
注:本文中的dojo-core/WeakMap.get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论