Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(get): add _get function #216

Merged
merged 4 commits into from
Jul 23, 2020
Merged

feat(get): add _get function #216

merged 4 commits into from
Jul 23, 2020

Conversation

eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Jul 23, 2020

This PR adds a method _get for internal usage.

Currently we cannot get the instance variables because the main interface is a function (aa()).
The initial reason for this functionality is because I need access to _hasCredentials.

The reason why I didn't make this function return a value, but make it accept a callback is,
it won't work in umd build.

!function(e,a,t,n,s,i,c){e.AlgoliaAnalyticsObject=s,e[s]=e[s]||function(){
(e[s].queue=e[s].queue||[]).push(arguments)},i=a.createElement(t),c=a.getElementsByTagName(t)[0],
i.async=1,i.src=n,c.parentNode.insertBefore(i,c)
}(window,document,"script",ALGOLIA_INSIGHTS_SRC,"aa");

According to the snippet,

window.aa is basically a function adding commands to the queue.

function () {
  (e[s].queue = e[s].queue || []).push(arguments);
}

In order to have the same signature across the browser and node env, I've decided to pass the callback function.

@eunjae-lee eunjae-lee changed the title feat(get): add tests feat(get): add _get function Jul 23, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 23, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit f2eeaf1:

Sandbox Source
Vanilla Configuration

@eunjae-lee eunjae-lee requested a review from a team July 23, 2020 09:12
@ghost ghost requested review from francoischalifour and yannickcr and removed request for a team July 23, 2020 09:12
@eunjae-lee eunjae-lee merged commit 3173c9b into master Jul 23, 2020
@eunjae-lee eunjae-lee deleted the feat/get branch July 23, 2020 09:31
@francoischalifour
Copy link
Member

What about having actual public APIs? (getAppId, getApiKey, etc.). Having a generic method that returns private data is not very safe because we're not in control of what users can retrieve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants