Skip to content
atk edited this page Apr 19, 2012 · 4 revisions

New API Proposal

On Wednesday, April 18th it was decided to redesign the API to be more accessible and less complex; at the same time the impact on the global scope should be reduced. This page should collect the proposals for the required API as well as future extensions to the same API.

Data transmission

The postMessage Communication will be removed; The AdPlayers will not correspond to DOM Nodes anymore, but will exist as objects with an ID that will be passed with each second/third party call.

Best practices

Methods with more than 2 arguments will receive the same in form of an object, e.g. instead of function(a, b, c), we will have function(options), the latter will contain { a: ..., b: ..., c: ...}.

It is not required to use the new initializer, because this is prone to errors. Instead the method creating a new Player will check whether this instanceOf AdPlayer and if not initialize the object itself:

AdPlayer = function(options) {
    return this instanceof AdPlayer ? this.create(options) : new AdPlayer().create(options);
}

The main functions should be as small as possible, leaving the main tasks to the prototypical methods.

Methods that are not required to return a specific result should always return this in order to be chainable.


Proposed by @atk (Alex Kloss)

Clone this wiki locally