Skip to content

Platform.isLinux and company should be const #35705

@Hixie

Description

@Hixie

We'd like to have code that does something like this:

// these are giant maps
const Map mac = {...};
const Map windows = {...};
const Map linux = {...};

convert(foo) {
  if (Platform.isMac)
    return mac[foo];
  if (Platform.isLinux)
    return linux[foo];
  if (Platform.isWindows)
    return windows[foo];
  return null;
}

We only want to ship the maps that apply to the current platform; we'd like the others to tree-shake out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-iotype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions