How to use the @glimmer/util.symbol function in @glimmer/util

To help you get started, we’ve selected a few @glimmer/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / symbols.ts View on Github external
import { symbol } from '@glimmer/util';

// These symbols represent "friend" properties that are used inside of
// the VM in other classes, but are not intended to be a part of
// Glimmer's API.

export const INNER_VM: unique symbol = symbol('INNER_VM');
export const DESTRUCTOR_STACK: unique symbol = symbol('DESTRUCTOR_STACK');
export const STACKS: unique symbol = symbol('STACKS');
export const REGISTERS: unique symbol = symbol('REGISTERS');
export const HEAP: unique symbol = symbol('HEAP');
export const CONSTANTS: unique symbol = symbol('CONSTANTS');
export const ARGS: unique symbol = symbol('ARGS');
export const PC: unique symbol = symbol('PC');
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / symbols.ts View on Github external
import { symbol } from '@glimmer/util';

// These symbols represent "friend" properties that are used inside of
// the VM in other classes, but are not intended to be a part of
// Glimmer's API.

export const INNER_VM: unique symbol = symbol('INNER_VM');
export const DESTRUCTOR_STACK: unique symbol = symbol('DESTRUCTOR_STACK');
export const STACKS: unique symbol = symbol('STACKS');
export const REGISTERS: unique symbol = symbol('REGISTERS');
export const HEAP: unique symbol = symbol('HEAP');
export const CONSTANTS: unique symbol = symbol('CONSTANTS');
export const ARGS: unique symbol = symbol('ARGS');
export const PC: unique symbol = symbol('PC');
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / symbols.ts View on Github external
import { symbol } from '@glimmer/util';

// These symbols represent "friend" properties that are used inside of
// the VM in other classes, but are not intended to be a part of
// Glimmer's API.

export const INNER_VM: unique symbol = symbol('INNER_VM');
export const DESTRUCTOR_STACK: unique symbol = symbol('DESTRUCTOR_STACK');
export const STACKS: unique symbol = symbol('STACKS');
export const REGISTERS: unique symbol = symbol('REGISTERS');
export const HEAP: unique symbol = symbol('HEAP');
export const CONSTANTS: unique symbol = symbol('CONSTANTS');
export const ARGS: unique symbol = symbol('ARGS');
export const PC: unique symbol = symbol('PC');
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / symbols.ts View on Github external
import { symbol } from '@glimmer/util';

// These symbols represent "friend" properties that are used inside of
// the VM in other classes, but are not intended to be a part of
// Glimmer's API.

export const INNER_VM: unique symbol = symbol('INNER_VM');
export const DESTRUCTOR_STACK: unique symbol = symbol('DESTRUCTOR_STACK');
export const STACKS: unique symbol = symbol('STACKS');
export const REGISTERS: unique symbol = symbol('REGISTERS');
export const HEAP: unique symbol = symbol('HEAP');
export const CONSTANTS: unique symbol = symbol('CONSTANTS');
export const ARGS: unique symbol = symbol('ARGS');
export const PC: unique symbol = symbol('PC');
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / symbols.ts View on Github external
import { symbol } from '@glimmer/util';

// These symbols represent "friend" properties that are used inside of
// the VM in other classes, but are not intended to be a part of
// Glimmer's API.

export const INNER_VM: unique symbol = symbol('INNER_VM');
export const DESTRUCTOR_STACK: unique symbol = symbol('DESTRUCTOR_STACK');
export const STACKS: unique symbol = symbol('STACKS');
export const REGISTERS: unique symbol = symbol('REGISTERS');
export const HEAP: unique symbol = symbol('HEAP');
export const CONSTANTS: unique symbol = symbol('CONSTANTS');
export const ARGS: unique symbol = symbol('ARGS');
export const PC: unique symbol = symbol('PC');
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / symbols.ts View on Github external
import { symbol } from '@glimmer/util';

// These symbols represent "friend" properties that are used inside of
// the VM in other classes, but are not intended to be a part of
// Glimmer's API.

export const INNER_VM: unique symbol = symbol('INNER_VM');
export const DESTRUCTOR_STACK: unique symbol = symbol('DESTRUCTOR_STACK');
export const STACKS: unique symbol = symbol('STACKS');
export const REGISTERS: unique symbol = symbol('REGISTERS');
export const HEAP: unique symbol = symbol('HEAP');
export const CONSTANTS: unique symbol = symbol('CONSTANTS');
export const ARGS: unique symbol = symbol('ARGS');
export const PC: unique symbol = symbol('PC');
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / symbols.ts View on Github external
import { symbol } from '@glimmer/util';

// These symbols represent "friend" properties that are used inside of
// the VM in other classes, but are not intended to be a part of
// Glimmer's API.

export const INNER_VM: unique symbol = symbol('INNER_VM');
export const DESTRUCTOR_STACK: unique symbol = symbol('DESTRUCTOR_STACK');
export const STACKS: unique symbol = symbol('STACKS');
export const REGISTERS: unique symbol = symbol('REGISTERS');
export const HEAP: unique symbol = symbol('HEAP');
export const CONSTANTS: unique symbol = symbol('CONSTANTS');
export const ARGS: unique symbol = symbol('ARGS');
export const PC: unique symbol = symbol('PC');
github glimmerjs / glimmer-vm / packages / @glimmer / object-reference / lib / meta.ts View on Github external
}
}

class ConstMeta /*implements IMeta*/ {
  private object: any;

  constructor(object: any) {
    this.object = object;
  }

  root(): ConstRoot {
    return new ConstRoot(this.object);
  }
}

export const CLASS_META: unique symbol = symbol('CLASS_META');

const hasOwnProperty = Object.hasOwnProperty;

class Meta implements IMeta, HasGuid {
  static for(obj: any): IMeta {
    if (obj === null || obj === undefined) return new Meta(obj, {});
    if (hasOwnProperty.call(obj, '_meta') && obj._meta) return obj._meta;
    if (!Object.isExtensible(obj)) return new ConstMeta(obj) as any;

    let MetaToUse: typeof Meta = Meta;

    if (obj.constructor && obj.constructor[CLASS_META]) {
      let classMeta: ClassMeta = obj.constructor[CLASS_META];
      MetaToUse = classMeta.InstanceMetaConstructor;
    } else if (obj[CLASS_META]) {
      MetaToUse = obj[CLASS_META].InstanceMetaConstructor;
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / environment.ts View on Github external
throw new RangeError(`BUG: cannot get $${index} from scope; length=${this.slots.length}`);
    }

    return this.slots[index] as T;
  }

  private set>(index: number, value: T): void {
    if (index >= this.slots.length) {
      throw new RangeError(`BUG: cannot get $${index} from scope; length=${this.slots.length}`);
    }

    this.slots[index] = value;
  }
}

export const TRANSACTION: TransactionSymbol = symbol('TRANSACTION');

class TransactionImpl implements Transaction {
  public scheduledInstallManagers: ModifierManager[] = [];
  public scheduledInstallModifiers: unknown[] = [];
  public scheduledUpdateModifierManagers: ModifierManager[] = [];
  public scheduledUpdateModifiers: unknown[] = [];
  public createdComponents: unknown[] = [];
  public createdManagers: WithCreateInstance[] = [];
  public updatedComponents: unknown[] = [];
  public updatedManagers: WithCreateInstance[] = [];
  public destructors: Drop[] = [];

  didCreate(component: unknown, manager: WithCreateInstance) {
    this.createdComponents.push(component);
    this.createdManagers.push(manager);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / reference / lib / iterable.ts View on Github external
done(env: Env): void;
}

export interface IteratorSynchronizerOptions {
  target: IteratorSynchronizerDelegate;
  artifacts: IterationArtifacts;
  env: Env;
}

enum Phase {
  Append,
  Prune,
  Done,
}

export const END = symbol('END');

export class IteratorSynchronizer {
  private target: IteratorSynchronizerDelegate;
  private iterator: OpaqueIterator;
  private current: Option;
  private artifacts: IterationArtifacts;
  private env: Env;

  constructor({ target, artifacts, env }: IteratorSynchronizerOptions) {
    this.target = target;
    this.artifacts = artifacts;
    this.iterator = artifacts.iterate();
    this.current = artifacts.head();
    this.env = env;
  }