canjs / can-connect-feathers

The FeathersJS client library for DoneJS and can-connect
https://canjs.com/doc/can-connect-feathers.html
MIT License
10 stars 4 forks source link

Feature: Async Connection via async feathersClient #104

Open frank-dspeed opened 6 years ago

frank-dspeed commented 6 years ago

This changes nothing from the existing API it adds only the option to supply a promise as feathers client i need this feature and think its usefull for any one who does newer coding styles and does things like i do:

frathers-client-async.js

/* global window */
import loader from '@loader';

let clientUrl;

if (window && window.fetch) {
  clientUrl = '~/models/feathers/v3/feathers-client.socketio.js';
} else {
  clientUrl = '~/models/feathers/v3/feathers-client.rest.js';
} 

export const feathersClient = loader.import(clientUrl).then((module)=>{ return module.feathersClient; }, err=>{
  new Error('Feathers-client Error '+ clientUrl,err);
}); 

export default feathersClient;

Usage

marshallswain commented 6 years ago

@justinbmeyer I don't have the available time to check this out. Could you give it a look?