How to use the strong-remoting.convert function in strong-remoting

To help you get started, we’ve selected a few strong-remoting examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ShoppinPal / Materializecss-Autocomplete / node_modules / loopback / lib / model.js View on Github external
];

    ModelCtor.sharedCtor.returns = {root: true};

    var remotingOptions = {};
    extend(remotingOptions, options.remoting || {});

    // create a sharedClass
    var sharedClass = ModelCtor.sharedClass = new SharedClass(
      ModelCtor.modelName,
      ModelCtor,
      remotingOptions
    );

    // setup a remoting type converter for this model
    RemoteObjects.convert(typeName, function(val) {
      return val ? new ModelCtor(val) : val;
    });

    // before remote hook
    ModelCtor.beforeRemote = function(name, fn) {
      var className = this.modelName;
      this._runWhenAttachedToApp(function(app) {
        var remotes = app.remotes();
        remotes.before(className + '.' + name, function(ctx, next) {
          return fn(ctx, ctx.result, next);
        });
      });
    };

    // after remote hook
    ModelCtor.afterRemote = function(name, fn) {