BSkyB / faber

Block based contents editor
Other
1 stars 1 forks source link

Faber initialization API #20

Closed charypar closed 10 years ago

charypar commented 10 years ago

I think we need to think of a nicer API to initialize faber than

window.faber = angular.module('faber', ['ngAnimate', 'ngCookies']).constant('faberConfig', {...}).run(function(contentService) {...})

And then talking to the faber global... Can we live without having a global variable using the Angular module system?

I have something like this in mind:

var faberInstance = faber('#my-app-root', {...config...});
faberInstance.load(documentData);
...
var editedDoc = faberInstance.save();

We should IMO try "hiding" the fact it's written in Angular from the API as an implementation detail. We still of course need to have Angular as a dependency.

Thoughts?

/cc @musshush, @fulljames

musshush commented 10 years ago

Faber now has init function you can just call using faber.init({config}), so now user doesn't have to directly change faber's module initialisation process which is covered in faber.coffee. And, of course, faber.import() and faber.export() are added as well. :wink:

charypar commented 10 years ago

:clap: