milo-core

ModelMsgAPI

declaration
ModelMsgAPI

Subclass of MessengerRegexpAPI that is used to translate messages of external messenger of Model to internal messenger of Model.

var ModelMsgAPI = _.createSubclass(MessengerRegexpAPI, 'ModelMsgAPI');

module.exports = ModelMsgAPI;

ModelMsgAPI instance methods

_.extendProto(ModelMsgAPI, {
    translateToSourceMessage: translateToSourceMessage,
});

translateToSourceMessage

function
translateToSourceMessage() ->RegExp String

Option name Type Description
accessPath String

relative access path to be translated

return RegExp,String

ModelMsgAPI instance method
Translates subscription paths with "*"s to regex, leaving other strings untouched.

function translateToSourceMessage(accessPath) {
    if (accessPath instanceof RegExp) return accessPath;

    return pathUtils.createRegexPath(accessPath);
}