Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Latest commit

 

History

History
28 lines (24 loc) · 914 Bytes

README.md

File metadata and controls

28 lines (24 loc) · 914 Bytes

travis build

User Environment

This package allows to detect the platform and the browser version used to view a web page.

Differentiated browsers are: IE, Edge, Chrome, Safari, Gecko, Opera, Electron, Other along with Mac, Windows and Other platforms.

Usage

import 'package:angular2/angular2.dart';
import 'package:user_environment_angular/user_environment.dart';

@Directive(
  selector: 'my-directive',
  providers: const [
  USER_ENVIRONMENT_PROVIDERS
  ]
)
class MyDirective {

  MyDirective(UserEnvironment env) {
  if (env.platform.type == UserPlatformType.Mac &&
    env.browser.type == BrowserType.Chrome &&
    env.browser.productVersion('AppleWebkit') == new BrowserVersion('1.2.3')) {
      // Do something
    }
  }
}