voryx / angular-wamp

An AngularJS library for AutobahnJS (WAMP v2)
MIT License
133 stars 28 forks source link

Publish to NPM #29

Closed morsdyce closed 9 years ago

morsdyce commented 9 years ago

I would appreciate if you could publish this package to npm for alternative workflows such as browserify and webpack

xiasenhai commented 9 years ago

:+1:

davidwdan commented 9 years ago

I created an NPM package.

npm install angular-wamp

Can you give it a try and let me know if it works?

I'm not 100% sure how that'll fit into your workflow, so any instructions you can provide for others would be much appreciated.

morsdyce commented 9 years ago

Hey David,

It did not work, but I created a pull request to do the necessary changes. Pull request: https://github.com/voryx/angular-wamp/pull/30

Regarding the use case for the workflow instead of including the scripts into the page by hand you can do the following:

npm install angular-wamp
import angular     from 'angular';
import angularWamp from 'angular-wamp';

// module definition
export default angular.module('app.starter', [angularWamp])
    .config(function($wampProvider) {
        $wampProvider.init({
            url: 'ws://127.0.0.1:9000/',
            realm: 'realm1'
            //Any other AutobahnJS options
        });
    })
    .run(function($wamp){
        $wamp.open();
    });

angular.bootstrap(document, ['app.starter']);

This also takes care of requiring autobahn and there is no need to include it manually.

I'd appreciate if you could merge the pull request and update the npm package.

Thanks

davidwdan commented 9 years ago

Merged https://github.com/voryx/angular-wamp/commit/4a5bff1c3977907aaa7206ff313afb4028a7b9f1