Skip to content

Commit

Permalink
Merge pull request #1105 from cozy/fix/RmTARGETref
Browse files Browse the repository at this point in the history
fix: Do not use __TARGET__ on a lib
  • Loading branch information
Crash-- authored Jul 16, 2019
2 parents b426cbc + 895b8e4 commit 3dd9228
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@
},
"globals": {
"__ALLOW_HTTP__": false,
"__TARGET__": "browser",
"cozy": {}
},
"testURL": "http://localhost/",
Expand Down
1 change: 0 additions & 1 deletion react/AppLinker/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ As it uses the render props pattern, it is flexible and can be used to build com
anchor.

```
window.__TARGET__ = 'web';
<AppLinker slug='banks' href='http://dalailama-banks.mycozy.cloud'>{
({ onClick, href, name }) => (
Expand Down
4 changes: 1 addition & 3 deletions react/AppLinker/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global __TARGET__ */

import React from 'react'
import PropTypes from 'prop-types'
import {
Expand Down Expand Up @@ -33,7 +31,7 @@ export class AppLinker extends React.Component {
}

componentDidMount() {
if (typeof __TARGET__ !== 'undefined' && __TARGET__ === 'mobile') {
if (isMobileApp()) {
this.checkAppAvailability()
}
}
Expand Down
2 changes: 1 addition & 1 deletion react/AppLinker/index.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('app icon', () => {
let spyConsoleError, openNativeFromNativeSpy, appSwitchMock

beforeEach(() => {
global.__TARGET__ = 'browser'
isMobileApp.mockReturnValue(false)
spyConsoleError = jest.spyOn(console, 'error')
spyConsoleError.mockImplementation(message => {
if (message.lastIndexOf('Warning: Failed prop type:') === 0) {
Expand Down

0 comments on commit 3dd9228

Please sign in to comment.