UNPKG

proteus-js-client

Version:

Proteus JavaScript Client

54 lines (45 loc) 1.52 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.FrameTypeNames = exports.FrameTypes = undefined; exports.getFrameTypeName = getFrameTypeName; var _forEachObject = require('fbjs/lib/forEachObject'); var _forEachObject2 = _interopRequireDefault(_forEachObject); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var FrameTypes = exports.FrameTypes = { BROKER_SETUP: 0x01, DESTINATION_SETUP: 0x02, GROUP: 0x03, BROADCAST: 0x04, SHARD: 0x05 }; // Maps frame type codes to type names /** * Copyright (c) 2017-present, Netifi Inc. * * 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. * * */ var FrameTypeNames = exports.FrameTypeNames = {}; (0, _forEachObject2.default)(FrameTypes, function (value, name) { FrameTypeNames[value] = name; }); function getFrameTypeName(type) { var name = FrameTypeNames[type]; return name != null ? name : toHex(type); } function toHex(n) { return '0x' + n.toString(16); }