react-native-star-io10
Version:
react-native-star-io10 is a library for supporting application development for Star Micronics devices.
35 lines (28 loc) • 1.2 kB
text/typescript
import { BaseStarXpandCommandBuilder } from './BaseStarXpandCommandBuilder';
import { StarXpandCommand } from '../../index';
import { StarXpandCommandParameterConverter } from './StarXpandCommandParameterConverter';
export class DrawerBuilder extends BaseStarXpandCommandBuilder {
public _parameters: Map<string, any>;
constructor() {
super();
this._parameters = new Map<string, any>([
["category", "Drawer"],
["contents", new Array<Map<string, any>>()]
]);
}
actionOpen(parameter: StarXpandCommand.Drawer.OpenParameter): DrawerBuilder {
this._addAction(async() => {
let contents = this._parameters.get("contents") as Array<Map<string, any>>;
contents.push(
new Map<string, any>([
["method", "Action.Open"],
["parameter", new Map<string, any>([
["channel", StarXpandCommandParameterConverter.convertDrawerChannel(parameter.channel)],
["on_time", Math.floor(parameter.onTime)]
])]
])
);
});
return this;
}
}