material-motion-runtime
Version:
The core architecture for Material Motion.
59 lines (58 loc) • 1.96 kB
TypeScript
/** @license
* Copyright 2016 - present The Material Motion Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
import TokenGenerator from './TokenGenerator';
import { Performing, PlanAndTarget } from './types';
export declare type ActivityListener = (kwargs: {
isActive: boolean;
}) => any;
/**
* A runtime is responsible for fulfilling Plans by delegating them to the
* correct Performer.
*/
export default class Runtime {
_performerMapSelector: (dict: {
[index: string]: any;
}) => any;
_performerMap: Map<any, Performing>;
_activityListeners: Set<ActivityListener>;
_isActive: boolean;
_isActiveTokenGenerator: TokenGenerator;
/**
* If any of this runtime's performers aren't at rest, this will be true.
*/
readonly isActive: boolean;
/**
* The runtime ensures the given plan is immediately applied to the given
* target.
*/
addPlan({plan, target}: PlanAndTarget): void;
/**
* Any function passed here will be called every time runtime.isActive
* changes.
*/
addActivityListener({listener}: {
listener: ActivityListener;
}): void;
/**
* Stops notifying the given listener of changes to runtime.isActive.
*/
removeActivityListener({listener}: {
listener: ActivityListener;
}): void;
_onTokenCountChange({count}: {
count: number;
}): void;
}