本文整理汇总了TypeScript中@dojo/shim/WeakMap.set函数的典型用法代码示例。如果您正苦于以下问题:TypeScript set函数的具体用法?TypeScript set怎么用?TypeScript set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: beforeProperties
beforeProperties(function(this: WidgetBase & { own: Function }, properties: any) {
const injectorItem = this.registry.getInjector<Store<S>>(name);
if (injectorItem) {
const { injector } = injectorItem;
const store = injector();
const registeredInjectors = registeredInjectorsMap.get(this) || [];
if (registeredInjectors.length === 0) {
registeredInjectorsMap.set(this, registeredInjectors);
}
if (registeredInjectors.indexOf(injectorItem) === -1) {
if (paths) {
const handle = store.onChange(paths.map((path: any) => store.path(path.join('/'))), () =>
this.invalidate()
);
this.own({
destroy: () => {
handle.remove();
}
});
} else {
this.own(
store.on('invalidate', () => {
this.invalidate();
})
);
}
registeredInjectors.push(injectorItem);
}
return getProperties(store, properties);
}
})(target);
开发者ID:dojo,项目名称:stores,代码行数:31,代码来源:StoreInjector.ts
示例2: Error
const append = (route: Route<Context, Parameters>) => {
if (hasBeenAppended(route)) {
throw new Error('Cannot append route that has already been appended');
}
this._routes.push(route);
parentMap.set(route, this);
};
开发者ID:dylans,项目名称:routing,代码行数:8,代码来源:Route.ts
示例3: constructor
constructor(source?: Iterable<T> | ArrayLike<T>) {
listItems.set(this, []);
if (source) {
forOf(source, (item: T) => {
this.add(item);
});
}
}
开发者ID:dylans,项目名称:core,代码行数:9,代码来源:List.ts
示例4: constructor
constructor(source?: Iterable<T> | ArrayLike<T>) {
listItems.set(this, []);
if (source) {
if (isArrayLike(source)) {
for (let i = 0; i < source.length; i++) {
this.add(source[i]);
}
} else if (isIterable(source)) {
for (const item of source) {
this.add(item);
}
}
}
}
开发者ID:jason0x43,项目名称:core,代码行数:15,代码来源:List.ts
示例5: configure
}
},
configure(this: AnyAction, configuration: Object): Promise<void> | void {
const configureFn = configureFunctions.get(this);
if (configureFn) {
return configureFn.call(this, configuration);
}
}
})
.mixin({
mixin: createStateful,
initialize(instance: AnyAction, { do: doFn, enabled = true, configure }: ActionOptions<any, ActionState>) {
if (!doFn) {
throw new TypeError(`'options.do' required during creation.`);
}
doFunctions.set(instance, doFn);
instance.setState({ enabled });
if (configure) {
configureFunctions.set(instance, configure);
}
instance.own({
destroy() {
doFunctions.delete(instance);
configureFunctions.delete(instance);
}
});
}
});
export default createAction;
开发者ID:dylans,项目名称:actions,代码行数:30,代码来源:createAction.ts
示例6: clear
clear(): void {
listItems.set(this, []);
}
开发者ID:jason0x43,项目名称:core,代码行数:3,代码来源:List.ts
示例7: constructor
constructor() {
privateStateMap.set(this, {
entryMap: new Map<Identity, Entry<V>>(),
idMap: new WeakMap<V, Identity>()
});
}
开发者ID:jason0x43,项目名称:core,代码行数:6,代码来源:IdentityRegistry.ts
示例8:
.init((instance) => {
handlesWeakMap.set(instance, []);
});
开发者ID:dylans,项目名称:compose,代码行数:3,代码来源:destroyableMixin.ts
示例9:
.init((instance: Stateful<State>) => {
instanceStateMap.set(instance, Object.create(null));
});
开发者ID:dylans,项目名称:compose,代码行数:3,代码来源:statefulMixin.ts
示例10: state
/**
* State change event type
*/
const stateChangedEventType = 'state:changed';
/**
* Create an instance of a stateful object
*/
const statefulMixin: StatefulMixin = eventedMixin
.extend('Stateful', {
get state(this: Stateful<State>) {
return instanceStateMap.get(this);
},
setState<S extends State>(this: Stateful<S>, value: Partial<S>) {
const oldState = instanceStateMap.get(this);
const state = deepAssign({}, oldState, value);
const eventObject = {
type: stateChangedEventType,
state,
target: this
};
instanceStateMap.set(this, state);
this.emit(eventObject);
}
})
.init((instance: Stateful<State>) => {
instanceStateMap.set(instance, Object.create(null));
});
export default statefulMixin;
开发者ID:dylans,项目名称:compose,代码行数:29,代码来源:statefulMixin.ts
注:本文中的@dojo/shim/WeakMap.set函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论