eduardolundgren / eduardolundgren/tracking.js

allow tracking.tracker => tracking#tracker

Open
#84 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

Both on Maira's talk at FrontinBH - great presentation btw - and at the documentation examples I saw this kind of example:

``` js
var myTracker = new tracking.MyTracker();

myTracker.on('track', function(event) {
// Results are inside the event
});

tracking.track('#myVideo', myTracker);
```

After talking with @eduardolundgren, I got that it might be important to keep `tracking.track( 'id', );`, this is even good for API backwards compatibility.

I wonder if it's possible to extend `tracking` prototype with a `track` method to call `tracking.track` giving the instanced obj, like this (following the last examples):

``` js
myTracker.track('#myVideo');
```

I believe it could be crude done this way:

``` js
tracking.prototype.track = function( elem ) {
tracking.track.call( elem, this );
};
```

The benefits would be directly related to a simple usage, it looks redundant calling tracking again.

Through by this issue's perspective, it would even be better to have `tracking` to `Tracking` to encourage its use only as a obj class/constructor. I need to go deep on the code to even allow my perception and build a better judgement.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the implementation and current usage of tracking.track, the tracking constructor/prototype, and the documentation examples shown in the issue. Decide whether an instance-level track method should complement the existing API; done means the proposed usage works without breaking tracking.track('id', instance) compatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-vision, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.