Skip to content

Commit

Permalink
Revert "Add VibrationAPI (jaredpalmer#54)"
Browse files Browse the repository at this point in the history
This reverts commit 01e5615.
  • Loading branch information
jaredpalmer committed Dec 13, 2017
1 parent cfdac28 commit a6cf4f5
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 299 deletions.
1 change: 0 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"avatar_url": "https://avatars3.githubusercontent.com/u/5678122?v=4",
"profile": "https://reinhold.is",
"contributions": [
"code",
"doc"
]
}
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ node_modules
*.log
dist
compiled
.DS_Store
.idea
.DS_Store
61 changes: 1 addition & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ _There's a lot more to do. The goal is to standardize almost every Web API on [M
- [Scroll props](#scroll-props)
- [`<Scroll render/>`](#scroll-render)
- [`withScroll()`](#withscroll)
- [Vibration](#vibration)
- [Vibration props](#vibration-props)
- [`<Vibration render/>`](#vibration-render)
- [`withVibration()`](#withvibration)
- [WindowSize](#windowsize)
- [WindowSize props](#windowsize-props)
- [`<WindowSize render/>`](#windowsize-render)
Expand Down Expand Up @@ -312,60 +308,6 @@ const Inner = ({ x, y }) => <div>Scroll Position: {x}, {y}</div>
export default withScroll(Inner)
```

## Vibration

Functions that enable components to handle vibration of a device. See
[MDN Vibration API](https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API)
and [MDN Navigator.vibrate()](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate)
for usage and browser support.
Note that Chrome on Android only allows vibration to happen on user gestures, so this will only work if you trigger vibration on touches or other user input.

### Vibration props

- `vibrate(pattern)`: Vibrate the device with the given pattern.
A number, or an array of numbers describing alternating periods of time in which the device is vibrating and not vibrating, in milliseconds.
- `persistentVibrate(pattern[, interval])`: Vibrate the device persistently, until it is canceled.
Optionally pass an interval that specifies how much time should pass between the start of each vibration pattern.
If no interval is passed, it will vibrate the patterns back-to-back.
- `cancelVibrations()`: Cancels any ongoing vibrations, as well as those scheduled with the `persistentVibrate()` method.

### `<Vibration render/>`

```js
import { Vibration } from 'react-fns'

const Example = () =>
<Vibration
render={({ vibrate, persistentVibrate, cancelVibrations }) =>
<div>
<button onClick={() => props.vibrate(100)}>vibrate for 100ms</button>
<button onClick={() => props.vibrate([100, 200, 100, 200, 100])}>vibrate 3x 100ms with 200ms breaks</button>
<button onClick={() => props.persistentVibrate(300, 1000)}>vibrate 300ms, each second</button>
<button onClick={() => props.cancelVibrations()}>cancel all vibrations</button>
</div>
}
/>

export default Example
```

### `withVibration()`

```js
import { withVibration } from 'react-fns'

const Inner = ({ vibrate, persistentVibrate, cancelVibrations }) => (
<div>
<button onClick={() => props.vibrate(100)}>vibrate for 100ms</button>
<button onClick={() => props.vibrate([100, 200, 100, 200, 100])}>vibrate 3 x 100ms with 200ms breaks</button>
<button onClick={() => props.persistentVibrate(300, 1000)}>vibrate 300ms, each second</button>
<button onClick={() => props.cancelVibrations()}>cancel all vibrations</button>
</div>
)

export default withVibration(Inner)
```

## WindowSize

### WindowSize props
Expand Down Expand Up @@ -496,10 +438,9 @@ See https://developer.mozilla.org/en-US/docs/WebAPI for the full list
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
| [<img src="https://avatars0.githubusercontent.com/u/92839?v=4" width="100px;"/><br /><sub><b>MICHAEL JACKSON</b></sub>](https://twitter.com/mjackson)<br />[🤔](#ideas-mjackson "Ideas, Planning, & Feedback") | [<img src="https://avatars2.githubusercontent.com/u/14926950?v=4" width="100px;"/><br /><sub><b>Pavel Prichodko</b></sub>](https://github.com/prichodko)<br />[💻](https://github.com/jaredpalmer/react-fns/commits?author=prichodko "Code") [📖](https://github.com/jaredpalmer/react-fns/commits?author=prichodko "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/7615?v=4" width="100px;"/><br /><sub><b>Richard Powell</b></sub>](https://github.com/rpowell)<br />[💻](https://github.com/jaredpalmer/react-fns/commits?author=rpowell "Code") | [<img src="https://avatars2.githubusercontent.com/u/3269550?v=4" width="100px;"/><br /><sub><b>Tim Brown</b></sub>](https://github.com/brimtown)<br />[📖](https://github.com/jaredpalmer/react-fns/commits?author=brimtown "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/8162598?v=4" width="100px;"/><br /><sub><b>Jack Moore</b></sub>](https://github.com/jtmthf)<br />[💻](https://github.com/jaredpalmer/react-fns/commits?author=jtmthf "Code") | [<img src="https://avatars0.githubusercontent.com/u/207870?v=4" width="100px;"/><br /><sub><b>Dayle Rees</b></sub>](http://www.daylerees.com)<br />[📖](https://github.com/jaredpalmer/react-fns/commits?author=daylerees "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/1520?v=4" width="100px;"/><br /><sub><b>Thomas Flemming</b></sub>](http://thomasflemming.no)<br />[📖](https://github.com/jaredpalmer/react-fns/commits?author=thomasfl "Documentation") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars0.githubusercontent.com/u/5314713?v=4" width="100px;"/><br /><sub><b>Sam Kvale</b></sub>](http://skvale.github.io)<br />[🐛](https://github.com/jaredpalmer/react-fns/issues?q=author%3Askvale "Bug reports") [💻](https://github.com/jaredpalmer/react-fns/commits?author=skvale "Code") | [<img src="https://avatars0.githubusercontent.com/u/320910?v=4" width="100px;"/><br /><sub><b>Rhys Powell</b></sub>](http://rpowell.me)<br />[💻](https://github.com/jaredpalmer/react-fns/commits?author=rpowelll "Code") | [<img src="https://avatars3.githubusercontent.com/u/5678122?v=4" width="100px;"/><br /><sub><b>Jeppe Reinhold</b></sub>](https://reinhold.is)<br />[💻](https://github.com/jaredpalmer/react-fns/commits?author=jreinhold "Code") [📖](https://github.com/jaredpalmer/react-fns/commits?author=jreinhold "Documentation") |
| [<img src="https://avatars0.githubusercontent.com/u/5314713?v=4" width="100px;"/><br /><sub><b>Sam Kvale</b></sub>](http://skvale.github.io)<br />[🐛](https://github.com/jaredpalmer/react-fns/issues?q=author%3Askvale "Bug reports") [💻](https://github.com/jaredpalmer/react-fns/commits?author=skvale "Code") | [<img src="https://avatars0.githubusercontent.com/u/320910?v=4" width="100px;"/><br /><sub><b>Rhys Powell</b></sub>](http://rpowell.me)<br />[💻](https://github.com/jaredpalmer/react-fns/commits?author=rpowelll "Code") |
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
"ts-jest": "^20.0.10",
"ts-lint": "^4.5.1",
"tsc-watch": "1.0.8",
"tslint": "^5.8.0",
"tslint-react": "^3.2.0",
"typescript": "^2.4.2"
},
Expand Down
85 changes: 0 additions & 85 deletions src/Vibration/Vibration.tsx

This file was deleted.

54 changes: 0 additions & 54 deletions src/Vibration/__tests__/Vibration.test.tsx

This file was deleted.

45 changes: 0 additions & 45 deletions src/Vibration/__tests__/withVibration.test.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/Vibration/index.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions src/Vibration/withVibration.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ export * from './GeoPosition';
export * from './Media';
export * from './WindowSize';
export * from './Locales';
export * from './Vibration';
2 changes: 0 additions & 2 deletions src/utils/featureDetection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ try {
(window as EventTarget).addEventListener('testPassive', noop, opts);
(window as EventTarget).removeEventListener('testPassive', noop, opts);
} catch (e) {}

export const supportsVibrationAPI = navigator && 'vibrate' in navigator;
30 changes: 4 additions & 26 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ aws4@^1.2.1:
version "1.6.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"

babel-code-frame@^6.20.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
babel-code-frame@^6.20.0, babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
dependencies:
Expand Down Expand Up @@ -417,7 +417,7 @@ bser@^2.0.0:
dependencies:
node-int64 "^0.4.0"

builtin-modules@^1.0.0, builtin-modules@^1.1.0, builtin-modules@^1.1.1:
builtin-modules@^1.0.0, builtin-modules@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"

Expand Down Expand Up @@ -2431,8 +2431,8 @@ react-media@^1.6.1:
prop-types "^15.5.10"

react-test-renderer@^15.6.1:
version "15.6.2"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-15.6.2.tgz#d0333434fc2c438092696ca770da5ed48037efa8"
version "15.6.1"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-15.6.1.tgz#026f4a5bb5552661fd2cc4bbcd0d4bc8a35ebf7e"
dependencies:
fbjs "^0.8.9"
object-assign "^4.1.0"
Expand Down Expand Up @@ -3081,32 +3081,10 @@ tslint-react@^3.2.0:
dependencies:
tsutils "^2.8.0"

tslint@^5.8.0:
version "5.8.0"
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.8.0.tgz#1f49ad5b2e77c76c3af4ddcae552ae4e3612eb13"
dependencies:
babel-code-frame "^6.22.0"
builtin-modules "^1.1.1"
chalk "^2.1.0"
commander "^2.9.0"
diff "^3.2.0"
glob "^7.1.1"
minimatch "^3.0.4"
resolve "^1.3.2"
semver "^5.3.0"
tslib "^1.7.1"
tsutils "^2.12.1"

tsutils@^1.1.0:
version "1.9.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0"

tsutils@^2.12.1:
version "2.12.2"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.12.2.tgz#ad58a4865d17ec3ddb6631b6ca53be14a5656ff3"
dependencies:
tslib "^1.7.1"

tsutils@^2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.8.0.tgz#0160173729b3bf138628dd14a1537e00851d814a"
Expand Down

0 comments on commit a6cf4f5

Please sign in to comment.